X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Ftime-dst.c;h=2797d1a7968a2b548fa73e3118bbadbeed0f01fe;hb=587fec427c80b6c34dcf1d7570f891fcb652a7c5;hp=6195b110176a3f05001a5d0c5d2c02a1795eddac;hpb=4f4b92ba7ae9c56cb0f181d5f95d709e085b8bd5;p=elogind.git
diff --git a/src/shared/time-dst.c b/src/shared/time-dst.c
index 6195b1101..2797d1a79 100644
--- a/src/shared/time-dst.c
+++ b/src/shared/time-dst.c
@@ -21,18 +21,12 @@
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see .
***/
-#include
#include
#include
#include
-#include
#include
#include
#include
-#include
-#include
-#include
-#include
#include
#include
#include
@@ -183,7 +177,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;
@@ -244,6 +239,8 @@ read_again:
if (fread(zone_names, 1, chars, f) != chars)
return -EINVAL;
+ zone_names[chars] = '\0';
+
for (i = 0; i < num_isstd; ++i) {
int c = getc(f);
if (c == EOF)