From: Ray Strode Date: Fri, 19 Nov 2010 20:27:12 +0000 (-0500) Subject: terminal: don't rely on strlen(bytes) for write size X-Git-Tag: 0.8.4~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba5054cc77bef76dae44b3debc80a499d36b782d;p=thirdparty%2Fplymouth.git terminal: don't rely on strlen(bytes) for write size 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. --- diff --git a/src/libply-splash-core/ply-terminal.c b/src/libply-splash-core/ply-terminal.c index 22db27df..a4b2a5aa 100644 --- a/src/libply-splash-core/ply-terminal.c +++ b/src/libply-splash-core/ply-terminal.c @@ -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); }