mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 21:48:09 +02:00
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.
This commit is contained in:
parent
a4c7cbafd3
commit
ba5054cc77
1 changed files with 3 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue