From c6a4eae10c8e022b5f55632bcb68465e1dfc9848 Mon Sep 17 00:00:00 2001 From: "Andrew V. Samoilov" Date: Thu, 21 Apr 2005 10:04:06 +0000 Subject: [PATCH] * utilvfs.c (is_localized_month): Check "month" for NULL and forbid punctuation characters in localized month abbreviation. --- vfs/ChangeLog | 5 +++++ vfs/utilvfs.c | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/vfs/ChangeLog b/vfs/ChangeLog index 3bf32b8b5..994d2754c 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +2005-04-21 Andrew V. Samoilov + + * utilvfs.c (is_localized_month): Check "month" for NULL and + forbid punctuation characters in localized month abbreviation. + 2005-04-13 Roland Illig * vfs.h: Fixed prototypes for mc_read() and mc_write(). Now they diff --git a/vfs/utilvfs.c b/vfs/utilvfs.c index ecb9dce6f..62b9a982a 100644 --- a/vfs/utilvfs.c +++ b/vfs/utilvfs.c @@ -336,17 +336,21 @@ is_month (const char *str, struct tm *tim) /* * 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++; }