diff options
author | Roy Marples <roy@marples.name> | 2008-01-07 12:29:30 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-01-07 12:29:30 +0000 |
commit | 43d0f3fc76542d0859c9b84402c0483a22e02b68 (patch) | |
tree | 125bcc9bf644a6390718868312df2b6be1905e89 /src/rc/rc-plugin.c | |
parent | 74e0e58b899accd2bd72a7d7303331e47089959f (diff) |
rc_getline keeps expanding it's malloced buffer until it has read a whole line or EOF. All functions which read into static buffers have been changed to use fhis function to avoid any potential overflows and to ensure we really do read a long long config line.
Diffstat (limited to 'src/rc/rc-plugin.c')
-rw-r--r-- | src/rc/rc-plugin.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rc/rc-plugin.c b/src/rc/rc-plugin.c index 613f049e..861f064d 100644 --- a/src/rc/rc-plugin.c +++ b/src/rc/rc-plugin.c @@ -197,10 +197,10 @@ void rc_plugin_run (rc_hook_t hook, const char *value) ssize_t nr; close (pfd[1]); - buffer = xmalloc (sizeof (char) * RC_LINEBUFFER); - memset (buffer, 0, RC_LINEBUFFER); + buffer = xmalloc (sizeof (char) * BUFSIZ); + memset (buffer, 0, BUFSIZ); - while ((nr = read (pfd[0], buffer, RC_LINEBUFFER)) > 0) { + while ((nr = read (pfd[0], buffer, BUFSIZ)) > 0) { p = buffer; while (*p && p - buffer < nr) { token = strsep (&p, "="); |