diff options
author | Roy Marples <roy@marples.name> | 2007-10-12 00:01:33 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-10-12 00:01:33 +0000 |
commit | 20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch) | |
tree | b195111871b8e05c584b71aed066c3990c5db2b3 /src/rc.c | |
parent | e3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff) |
malloc over fatty buffers
Diffstat (limited to 'src/rc.c')
-rw-r--r-- | src/rc.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -382,7 +382,7 @@ static int do_options (int argc, char **argv) static char *proc_getent (const char *ent) { FILE *fp; - char buffer[RC_LINEBUFFER]; + char *buffer; char *p; char *value = NULL; int i; @@ -395,7 +395,8 @@ static char *proc_getent (const char *ent) return (NULL); } - memset (buffer, 0, sizeof (buffer)); + buffer = xmalloc (sizeof (char) * RC_LINEBUFFER); + memset (buffer, 0, RC_LINEBUFFER); if (fgets (buffer, RC_LINEBUFFER, fp) && (p = strstr (buffer, ent))) { @@ -413,6 +414,7 @@ static char *proc_getent (const char *ent) } } else errno = ENOENT; + free (buffer); fclose (fp); return (value); |