Print this page
locale stuff should use libc safe lmalloc.  Other fixes from tests.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libc/port/locale/rune.c
          +++ new/usr/src/lib/libc/port/locale/rune.c
↓ open down ↓ 36 lines elided ↑ open up ↑
  37   37  #include <errno.h>
  38   38  #include <stdio.h>
  39   39  #include <string.h>
  40   40  #include <stdlib.h>
  41   41  #include <sys/types.h>
  42   42  #include <sys/stat.h>
  43   43  #include <sys/mman.h>
  44   44  #include <fcntl.h>
  45   45  #include <unistd.h>
  46   46  
       47 +#include "libc.h"
  47   48  #include "runetype.h"
  48   49  #include "runefile.h"
  49   50  
  50   51  _RuneLocale *
  51   52  _Read_RuneMagi(const char *fname)
  52   53  {
  53   54          char *fdata, *data;
  54   55          void *lastp;
  55   56          _FileRuneLocale *frl;
  56   57          _RuneLocale *rl;
↓ open down ↓ 75 lines elided ↑ open up ↑
 132  133                  }
 133  134          }
 134  135  
 135  136          if ((char *)variable + frl->variable_len > (char *)lastp) {
 136  137                  goto invalid;
 137  138          }
 138  139  
 139  140          /*
 140  141           * Convert from disk format to host format.
 141  142           */
 142      -        data = malloc(sizeof (_RuneLocale) +
      143 +        data = libc_malloc(sizeof (_RuneLocale) +
 143  144              (frl->runetype_ext_nranges + frl->maplower_ext_nranges +
 144  145              frl->mapupper_ext_nranges) * sizeof (_RuneEntry) +
 145  146              runetype_ext_len * sizeof (*rr->__types) +
 146  147              frl->variable_len);
 147  148          if (data == NULL) {
 148  149                  saverr = errno;
 149  150                  (void) munmap(fdata, sb.st_size);
 150  151                  errno = saverr;
 151  152                  return (NULL);
 152  153          }
↓ open down ↓ 92 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX