bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hopefully last bug in windows timezone handling


From: Roland Schwingel
Subject: Hopefully last bug in windows timezone handling
Date: Fri, 18 Jan 2008 12:58:46 +0100
User-agent: Thunderbird 1.5.0.14 (Windows/20071210)

Hi...

With the last patch to windows timezone handling there was an unterminated string introduced. The funny thing, in 99.999999999999% of the time this works without trouble but sometimes this could lead to a buffer overrun.The attached patch fixes this (it is relative to svn trunk)

Thanks for applying,

Roland

--- NSTimeZone.m.orig   2008-01-18 12:49:28.000000000 +0100
+++ NSTimeZone.m        2008-01-18 12:51:46.000000000 +0100
@@ -2177,10 +2177,12 @@
 
        if (cSubKeys && (retCode == ERROR_SUCCESS))
        {
-               wchar_t *wName = malloc(([name length]+1) * sizeof(wchar_t));
+               int wLen = [name length];
+               wchar_t *wName = malloc((wLen+1) * sizeof(wchar_t));
                if (wName)
                {
                        [name getCharacters:wName];
+                               wName[wLen] = L'\0';
 
                                for (i=0; i<cSubKeys && !tzFound; i++) 
                                { 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]