summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-02-05 21:06:43 +0000
committerRoy Marples <roy@marples.name>2009-02-05 21:06:43 +0000
commit73454ab163177c8684631ea234b24ee2782a6fb9 (patch)
tree34445b6fa929d14f8b56e031b163705fb5ba6808
parent760f7628bceabdeb77e0485c111a6fb330864179 (diff)
downloaddhcpcd-73454ab163177c8684631ea234b24ee2782a6fb9.tar.xz
Ensure the buffer is NULL terminated.
-rw-r--r--control.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/control.c b/control.c
index ddc51ef9..2786b23a 100644
--- a/control.c
+++ b/control.c
@@ -76,11 +76,12 @@ handle_control_data(void *arg)
char *e, *p;
char **ap;
- bytes = read(l->fd, buffer, sizeof(buffer));
+ bytes = read(l->fd, buffer, sizeof(buffer) - 1);
if (bytes == -1 || bytes == 0) {
remove_control_data(l);
return;
}
+ buffer[bytes] = '\0';
p = buffer;
e = buffer + bytes;
argc = 0;