]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: ensure add_consoles_from_file terminates buffer string
authorRay Strode <rstrode@redhat.com>
Mon, 10 Dec 2012 16:55:32 +0000 (11:55 -0500)
committerRay Strode <rstrode@redhat.com>
Mon, 10 Dec 2012 16:55:32 +0000 (11:55 -0500)
This isn't a real problem in practice, since the files getting
read will be much smaller than the buffer, but it looks bad.

This commit ensures the buffer always leaves room for the terminating
NUL.

src/main.c

index e57b25ac4e01a0b9d2a601a90daed9f1b7a1f88c..6ceb27a4a252b450ecf60f5882a53531f7a4c635 100644 (file)
@@ -1967,7 +1967,7 @@ add_consoles_from_file (state_t         *state,
     }
 
   ply_trace ("reading file");
-  contents_length = read (fd, contents, sizeof (contents));
+  contents_length = read (fd, contents, sizeof (contents) - 1);
 
   if (contents_length <= 0)
     {