From 699670a264c7fc5a0b05c2d258a7552f5c594bd1 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 17 Jul 2012 02:24:52 +0300 Subject: [PATCH] Variable length arrays on stack are not valid C++ --- source/time/timezone.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/time/timezone.cpp b/source/time/timezone.cpp index a755954..a2cd7a3 100644 --- a/source/time/timezone.cpp +++ b/source/time/timezone.cpp @@ -61,7 +61,7 @@ TimeZone get_local_timezone() long typecnt = get_long(ptr); long charcnt = get_long(ptr); int size = timecnt*5+typecnt*6+isgmtcnt+isstdcnt+leapcnt*8+charcnt; - char buf[size]; + char *buf = new char[size]; len = read(fd, buf, size); if(len==size) { @@ -91,6 +91,7 @@ TimeZone get_local_timezone() name = ptr+abbrind; } + delete[] buf; } close(fd); -- 2.43.0