[glib] tests/unix: Ensure buffer is NUL terminated



commit 7d622157f055d9fb0ae3686f2b7a4fd1952af258
Author: Colin Walters <walters verbum org>
Date:   Thu Jun 21 15:33:51 2012 -0400

    tests/unix: Ensure buffer is NUL terminated

 glib/tests/unix.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/unix.c b/glib/tests/unix.c
index 77ee61e..9051ade 100644
--- a/glib/tests/unix.c
+++ b/glib/tests/unix.c
@@ -43,6 +43,7 @@ test_pipe (void)
   memset (buf, 0, sizeof (buf));
   bytes_read = read (pipefd[0], buf, sizeof(buf) - 1);
   g_assert_cmpint (bytes_read, >, 0);
+  buf[bytes_read] = '\0';
 
   close (pipefd[0]);
   close (pipefd[1]);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]