[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] NSCalendar date patch
From: |
Wim Oudshoorn |
Subject: |
[PATCH] NSCalendar date patch |
Date: |
Wed, 25 Feb 2004 14:22:34 +0100 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (darwin) |
I will commit this patch shortly if nobody objects
Problem
-------
The method -[NSCalendarDate descriptionWithCalendarFormat:locale:]
has the following problems:
* potential buffer overrun (statically allocated result on stack)
* if an unrecognized character follows the % sign in the format
the result is not correct, it will miss the character following
the unrecognized character. For example:
"%8Hallo" will result in something like "%8allo".
* the format string "%b %B" does not work, it is treated as
"%b %b". Reason is that a flag is set upon the first
%b which is not reset. Same problem occurs with
%Y and a few others
* %c, %x and %X are not recognized
Solution
--------
The following patch will solve all these problems EXCEPT
the first. It will introduce a strcpy of the format string
which is in most cases not necessary, but I do not
think this is a critical problem.
Also the %c %X %x conversion are not really efficient.
And it bothers me a little that the buffer overrun is
still there, but getting rid of that requires siginificantly
more work.
nscalendardate.patch
Description: fix descriptionWithFormat
Wim Oudshoorn.
- [PATCH] NSCalendar date patch,
Wim Oudshoorn <=