]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
terminal: don't rely on strlen(bytes) for write size
authorRay Strode <rstrode@redhat.com>
Fri, 19 Nov 2010 20:27:12 +0000 (15:27 -0500)
committerRay Strode <rstrode@redhat.com>
Fri, 19 Nov 2010 20:27:12 +0000 (15:27 -0500)
We're printing stuff to the terminal.  This may include
NUL bytes once in a while.  We shouldn't rely on strlen()
to determine how many bytes to write.

src/libply-splash-core/ply-terminal.c

index 22db27df74e50f484d2a27c54d746c0046f53659..a4b2a5aaa1d1a9924c6eb7ef6a54a1b979058a73 100644 (file)
@@ -271,16 +271,17 @@ ply_terminal_write (ply_terminal_t *terminal,
 {
   va_list args;
   char *string;
+  int size;
 
   assert (terminal != NULL);
   assert (format != NULL);
 
   string = NULL;
   va_start (args, format);
-  vasprintf (&string, format, args);
+  size = vasprintf (&string, format, args);
   va_end (args);
 
-  write (terminal->fd, string, strlen (string));
+  write (terminal->fd, string, size);
   free (string);
 }