summaryrefslogtreecommitdiff
path: root/src/shared/time-dst.c
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2014-12-15 13:06:48 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2014-12-15 13:50:11 +0100
commite17fb3c1dd21929119968325c46ab98630446032 (patch)
tree0013f98e139068acda0f1de20d96e0bc66175b70 /src/shared/time-dst.c
parentd47f6ca5f9b7a0b400d8bdb050151a0284fb4bdb (diff)
shared: time-dst: Avoid buffer overflow
Commit 681f9718 introduced an additional null terminator for the zone names. Increase the allocation of "transitions" to actually make room for this.
Diffstat (limited to 'src/shared/time-dst.c')
-rw-r--r--src/shared/time-dst.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/time-dst.c b/src/shared/time-dst.c
index 926d22b94..1ce6f721b 100644
--- a/src/shared/time-dst.c
+++ b/src/shared/time-dst.c
@@ -183,7 +183,8 @@ read_again:
return -EINVAL;
}
- transitions = malloc0(total_size + tzspec_len);
+ /* leave space for additional zone_names zero terminator */
+ transitions = malloc0(total_size + tzspec_len + 1);
if (transitions == NULL)
return -EINVAL;