* utilvfs.c (is_localized_month): segfault fix



Hello!

-- 
Regards,
Andrew V. Samoilov

________________________________________________________________
GET INTERNET ACCESS FROM BCS! http://www.bcs.zp.ua
Join BCS today! For your FREE webmail, visit: http://email.zp.ua/
vfs/ChangeLog:

	* utilvfs.c (is_localized_month): Check "month" for NULL and
	forbid punctuation characters in localized month abbreviation.
	
--- utilvfs.c.orig	Mon Sep 27 09:29:54 2004
+++ utilvfs.c	Thu Apr  7 11:55:53 2005
@@ -331,17 +336,21 @@ is_month (const char *str, struct tm *ti
 
 /*
  * Check for possible locale's abbreviated month name (Jan..Dec).
- * Any 3 bytes long string without digit and control characters.
+ * Any 3 bytes long string without digit, control and punctuation characters.
  * isalpha() is locale specific, so it cannot be used if current
  * locale is "C" and ftp server use Cyrillic.
- * TODO: Punctuation characters also cannot be part of month name.
  * NB: It is assumed there are no whitespaces in month.
  */
 static int
 is_localized_month (const unsigned char *month)
 {
     int i = 0;
-    while ((i < 3) && *month && !isdigit (*month) && !iscntrl (*month)) {
+
+    if (!month)
+	return 0;
+
+    while ((i < 3) && *month && !isdigit (*month) && !iscntrl (*month)
+	   && !ispunct (*month)) {
 	i++;
 	month++;
     }


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