mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-27 13:57:26 +03:00
bus-message: fix skipping of array fields in !gvariant messages
We copied part of the string into a buffer that was off by two. If the element signature had length one, we'd copy 0 bytes and crash when looking at the "first" byte. Otherwise, we would crash because strncpy would not terminate the string.
This commit is contained in:
parent
0b4775b527
commit
73777ddba5
@ -4964,12 +4964,12 @@ static int message_skip_fields(
|
||||
|
||||
assert(l >= 1);
|
||||
{
|
||||
char sig[l-1], *s;
|
||||
char sig[l + 1], *s = sig;
|
||||
uint32_t nas;
|
||||
int alignment;
|
||||
|
||||
strncpy(sig, *signature + 1, l-1);
|
||||
s = sig;
|
||||
strncpy(sig, *signature + 1, l);
|
||||
sig[l] = '\0';
|
||||
|
||||
alignment = bus_type_get_alignment(sig[0]);
|
||||
if (alignment < 0)
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user