aboutsummaryrefslogtreecommitdiff
path: root/src/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
committerRoy Marples <roy@marples.name>2007-10-12 00:01:33 +0000
commit20a149b2c7bfd7e53d24d0665281c083d7362c67 (patch)
treeb195111871b8e05c584b71aed066c3990c5db2b3 /src/rc.c
parente3bc6666d6d5bd8922ca10652a2d04577357fa71 (diff)
malloc over fatty buffers
Diffstat (limited to 'src/rc.c')
-rw-r--r--src/rc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rc.c b/src/rc.c
index 0f21fe86..773bb457 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -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);