SOURCES: poldek-crash-on-invalid-locale.patch (NEW) - fixes crash on invali...

megabajt megabajt at pld-linux.org
Sun Nov 23 16:27:59 CET 2008


Author: megabajt                     Date: Sun Nov 23 15:27:59 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixes crash on invalid locale (pl.UTF_8 instead of pl.UTF-8)

---- Files affected:
SOURCES:
   poldek-crash-on-invalid-locale.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/poldek-crash-on-invalid-locale.patch
diff -u /dev/null SOURCES/poldek-crash-on-invalid-locale.patch:1.1
--- /dev/null	Sun Nov 23 16:27:59 2008
+++ SOURCES/poldek-crash-on-invalid-locale.patch	Sun Nov 23 16:27:53 2008
@@ -0,0 +1,29 @@
+diff -urN poldek-0.30-cvs20080820.23/misc.c poldek-0.30-cvs20080820.23.new/misc.c
+--- poldek-0.30-cvs20080820.23/misc.c	2008-07-19 11:52:31.000000000 +0200
++++ poldek-0.30-cvs20080820.23.new/misc.c	2008-11-23 15:54:42.835970687 +0100
+@@ -626,7 +626,7 @@
+  */
+ static char *cut_country_code (const char *lang)
+ {
+-    char *p, *q, *newlang;
++    char *c, *p, *q, *newlang;
+ 
+     if ((q = strchr(lang, '_')) == NULL)
+ 	return NULL;
+@@ -636,10 +636,12 @@
+     
+     p = n_strncpy(newlang, lang, q - lang + 1);
+     
+-    if ((q = strchr(lang, '.')))
+-	n_strncpy(p, q, strlen(q) + 1);
+-    else if ((q = strchr(lang, '@')))
+-	n_strncpy(p, q, strlen(q) + 1);
++    if ((c = strchr(q, '.')))
++	n_strncpy(p, c, strlen(c) + 1);
++    else if ((c = strchr(q, '@')))
++	n_strncpy(p, c, strlen(c) + 1);
++
++    n_assert(strlen(lang) > strlen(newlang));
+     
+     return newlang;
+ }
================================================================


More information about the pld-cvs-commit mailing list