]> git.pld-linux.org Git - packages/poldek.git/blame - poldek-crash-on-invalid-locale.patch
- updated for 0.30rc1
[packages/poldek.git] / poldek-crash-on-invalid-locale.patch
CommitLineData
650c5ca3
MB
1diff -urN poldek-0.30-cvs20080820.23/misc.c poldek-0.30-cvs20080820.23.new/misc.c
2--- poldek-0.30-cvs20080820.23/misc.c 2008-07-19 11:52:31.000000000 +0200
3+++ poldek-0.30-cvs20080820.23.new/misc.c 2008-11-23 15:54:42.835970687 +0100
4@@ -626,7 +626,7 @@
5 */
6 static char *cut_country_code (const char *lang)
7 {
8- char *p, *q, *newlang;
9+ char *c, *p, *q, *newlang;
10
11 if ((q = strchr(lang, '_')) == NULL)
12 return NULL;
13@@ -636,10 +636,12 @@
14
15 p = n_strncpy(newlang, lang, q - lang + 1);
16
17- if ((q = strchr(lang, '.')))
18- n_strncpy(p, q, strlen(q) + 1);
19- else if ((q = strchr(lang, '@')))
20- n_strncpy(p, q, strlen(q) + 1);
21+ if ((c = strchr(q, '.')))
22+ n_strncpy(p, c, strlen(c) + 1);
23+ else if ((c = strchr(q, '@')))
24+ n_strncpy(p, c, strlen(c) + 1);
25+
26+ n_assert(strlen(lang) > strlen(newlang));
27
28 return newlang;
29 }
This page took 0.056547 seconds and 4 git commands to generate.