chiark / gitweb /
notify: properly NUL-terminate received messages
authorLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 21:13:40 +0000 (23:13 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Jun 2010 21:13:40 +0000 (23:13 +0200)
src/manager.c

index c2d5e5f..dee6109 100644 (file)
@@ -1656,7 +1656,8 @@ static int manager_process_notify_fd(Manager *m) {
                                 continue;
                         }
 
-                char_array_0(buf);
+                assert((size_t) n < sizeof(buf));
+                buf[n] = 0;
                 if (!(tags = strv_split(buf, "\n\r")))
                         return -ENOMEM;