Diff for /embedaddon/sudo/plugins/sudoers/tsgetgrpw.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/07/22 10:46:12 version 1.1.1.3, 2013/10/14 07:56:35
Line 123  getpwent(void) Line 123  getpwent(void)
     static struct passwd pw;      static struct passwd pw;
     static char pwbuf[LINE_MAX];      static char pwbuf[LINE_MAX];
     size_t len;      size_t len;
    unsigned long id;    id_t id;
    char *cp, *colon, *ep;    char *cp, *colon;
     const char *errstr;
   
 next_entry:  next_entry:
     if ((colon = fgets(pwbuf, sizeof(pwbuf), pwf)) == NULL)      if ((colon = fgets(pwbuf, sizeof(pwbuf), pwf)) == NULL)
         return NULL;          return NULL;
   
    zero_bytes(&pw, sizeof(pw));    memset(&pw, 0, sizeof(pw));
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
     *colon++ = '\0';      *colon++ = '\0';
Line 142  next_entry: Line 143  next_entry:
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
     *colon++ = '\0';      *colon++ = '\0';
    id = strtoul(cp, &ep, 10);    id = atoid(cp, NULL, NULL, &errstr);
    if (*cp == '\0' || *ep != '\0')    if (errstr != NULL)
         goto next_entry;          goto next_entry;
     if (id > UID_MAX || (id == ULONG_MAX && errno == ERANGE))  
         goto next_entry;  
     pw.pw_uid = (uid_t)id;      pw.pw_uid = (uid_t)id;
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
     *colon++ = '\0';      *colon++ = '\0';
    id = strtoul(cp, &ep, 10);    id = atoid(cp, NULL, NULL, &errstr);
    if (*cp == '\0' || *ep != '\0')    if (errstr != NULL)
         goto next_entry;          goto next_entry;
     if (id > GID_MAX || (id == ULONG_MAX && errno == ERANGE))  
         goto next_entry;  
     pw.pw_gid = (gid_t)id;      pw.pw_gid = (gid_t)id;
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
Line 255  getgrent(void) Line 252  getgrent(void)
     static struct group gr;      static struct group gr;
     static char grbuf[LINE_MAX], *gr_mem[GRMEM_MAX+1];      static char grbuf[LINE_MAX], *gr_mem[GRMEM_MAX+1];
     size_t len;      size_t len;
    unsigned long id;    id_t id;
    char *cp, *colon, *ep;    char *cp, *colon;
     const char *errstr;
     int n;      int n;
   
 next_entry:  next_entry:
     if ((colon = fgets(grbuf, sizeof(grbuf), grf)) == NULL)      if ((colon = fgets(grbuf, sizeof(grbuf), grf)) == NULL)
         return NULL;          return NULL;
   
    zero_bytes(&gr, sizeof(gr));    memset(&gr, 0, sizeof(gr));
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
     *colon++ = '\0';      *colon++ = '\0';
Line 275  next_entry: Line 273  next_entry:
     if ((colon = strchr(cp = colon, ':')) == NULL)      if ((colon = strchr(cp = colon, ':')) == NULL)
         goto next_entry;          goto next_entry;
     *colon++ = '\0';      *colon++ = '\0';
    id = strtoul(cp, &ep, 10);    id = atoid(cp, NULL, NULL, &errstr);
    if (*cp == '\0' || *ep != '\0')    if (errstr != NULL)
        goto next_entry; 
    if (id > GID_MAX || (id == ULONG_MAX && errno == ERANGE)) 
         goto next_entry;          goto next_entry;
     gr.gr_gid = (gid_t)id;      gr.gr_gid = (gid_t)id;
     len = strlen(colon);      len = strlen(colon);

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>