]> andersk Git - moira.git/commitdiff
don't overflow buf for people with really long group lists (sloan sucks)
authorjweiss <jweiss>
Wed, 1 Sep 1999 16:47:55 +0000 (16:47 +0000)
committerjweiss <jweiss>
Wed, 1 Sep 1999 16:47:55 +0000 (16:47 +0000)
gen/nfs.pc

index 7ce9957b4213a75324caf2de3cb988ac93dd8b82..ad4541f25e1fe1dbc3947a38e03a02951a443674 100644 (file)
@@ -218,7 +218,8 @@ struct user {
 
 void do_everyone(void)
 {
-  char buf[MAXPATHLEN], *l;
+  const buflen = MAXPATHLEN;
+  char buf[buflen], *l;
   struct user *u;
   struct grp *g;
   struct bucket *b, **p;
@@ -306,7 +307,16 @@ void do_everyone(void)
          u = (struct user *)b->data;
          sprintf(buf, "%s:%d:101", u->name, u->uid);
          for (g = u->lists; g; g = g->next)
-           strcat(buf, g->lid);
+           {
+             if ((strlen(buf) + strlen(g->lid)) <= buflen)
+               strcat(buf, g->lid);
+             else
+               {
+                 com_err(whoami, 0, "truncated server-side grp list for %s",
+                         u->name);
+                 break;
+               }
+           }
          b->data = strdup(buf);
          fprintf(fd, "%s\n", buf);
        }
This page took 0.043788 seconds and 5 git commands to generate.