Bug in util.c may crash slrn with us-ascii_override.patch
Thomas Wiegner <[email protected]>
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Organization | Powered by Penguin |
| Message-ID | <20070704213556.GB4212@fliewatuet> |
Hi Folks,
my us-ascii_override.patch may cause a crash, when reading an
article without a correct charset declaration and running slrn
in a non-utf8 locale.
It triggers a bug slrn_case_strncmp() function of util.c, which
does no checks for NULL pointers in the arguments when run
in a non UTF-8 locale but does them when running in UTF-8 locale.
The updated us-ascii_override_patch can be found at
<http://www.foory.de/thw/slrn/>
Thanks to Christian for reporting me the problem.
Thomas
PS: here is the patch for util.c
<-------------- cut here ------------------>
--- src/util.c 2006-10-30 21:14:49.000000000 +0100
+++ src/util.c 2007-07-04 17:42:04.000000000 +0200
@@ -153,19 +153,18 @@
{
register unsigned char cha, chb, *bmax;
+ if (a == NULL)
+ {
+ if (b == NULL)
+ return 0;
+ else
+ return -1;
+ }
+ if (b == NULL)
+ return 1;
#if SLANG_VERSION >= 20000
if (Slrn_UTF8_Mode)
{
- if (a == NULL)
- {
- if (b == NULL)
- return 0;
- else
- return -1;
- }
- if (b == NULL)
- return 1;
-
return SLutf8_compare(a, a+strlen(a), b, b+strlen(b), n , 0);
}
#endif
--
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/