mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Protect against GSPrivateNativeCStringEncoding() corrupting the return
value of setlocale(). Bug #52331 reported by Jakub Wilk <jwilk@jwilk.net>.
This commit is contained in:
parent
ded6cf852a
commit
7c68c30928
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2017-11-04 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Source/GSLocale.m: Protect against
|
||||
GSPrivateNativeCStringEncoding() corrupting the return value of
|
||||
setlocale(). Bug #52331 reported by Jakub Wilk <jwilk@jwilk.net>.
|
||||
|
||||
2017-10-26 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
* Source/NSDateFormatter.m: Fix how UDateFormat is created. Fixes
|
||||
|
|
|
@ -64,6 +64,10 @@ static NSString *
|
|||
privateSetLocale(int category, NSString *locale)
|
||||
{
|
||||
const char *clocale = NULL;
|
||||
/* Need to get the encoding first as the function call invalidates
|
||||
* the return value of setlocale()
|
||||
*/
|
||||
NSStringEncoding enc = GSPrivateNativeCStringEncoding();
|
||||
if (locale != nil)
|
||||
{
|
||||
clocale = [locale cString];
|
||||
|
@ -72,7 +76,7 @@ privateSetLocale(int category, NSString *locale)
|
|||
|
||||
if (clocale != NULL)
|
||||
{
|
||||
return ToString(clocale);
|
||||
return [NSString stringWithCString: clocale encoding: enc];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue