]> git.pld-linux.org Git - packages/util-linux.git/blob - util-linux-gecos.patch
- optimize in a way that nothing is done if config is empty
[packages/util-linux.git] / util-linux-gecos.patch
1 --- util-linux-2.10m/login-utils/chfn.c Sun May 14 19:27:59 2000
2 +++ util-linux-2.10m/login-utils/chfn.c Thu Jun  1 06:24:25 2000
3 @@ -84,7 +84,7 @@
4  #define memzero(ptr, size) memset((char *) ptr, 0, size)
5  
6  /* we do not accept gecos field sizes longer than MAX_FIELD_SIZE */
7 -#define MAX_FIELD_SIZE         256
8 +#define MAX_FIELD_SIZE         64
9  
10  int main (int argc, char **argv) {
11      char *cp;
12 @@ -408,6 +408,12 @@
13         return -1;
14      }
15  
16 +    if (strlen(gecos) > MAX_FIELD_SIZE) {
17 +       if (msg != NULL)
18 +           printf("%s: ", msg);
19 +       printf("field is too long.\n");
20 +       return -1;
21 +    }
22      for (i = 0; i < strlen (gecos); i++) {
23         c = gecos[i];
24         if (c == ',' || c == ':' || c == '=' || c == '"' || c == '\n') {
This page took 0.049638 seconds and 3 git commands to generate.