[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: KVC bug
Re: KVC bug
Wed, 27 Feb 2002 12:19:26 +0100 (CET)
On Wed, 27 Feb 2002 09:26:34 +0000 Richard Frith-Macdonald
>| On Wednesday, February 27, 2002, at 08:46 AM, Manuel Guesdon wrote:
>| > Hi,
>| > There's a bug in KVC.
>| > When constructing setValue:forKey: method name, the method in has
>| > garbage at the end (after the ':').
>| > In NSKeyValueCoding.m, I think there should be a
>| > buf[size+5] = '\0';
>| > after each
>| > buf[size+4] = ':';
>| Thanks ... fixed for the initial setup in takeValue:forKey and
>| I don't think there is anywhere else that needs it is there?
I haven't found this problem elsewhere.
>| > BTW, is it possible to use strncpy instead of strcpy each time it's
>| > possible to try to minimize buffer overflows, even if
>| > size seems to be well known ?
>| Well, if size isn't well known the code will fail anyway, so there
>| doesn't seem much point.
I was a general comment as many people recommends its general usage.
>| PS. Also implemented MacOS-X compatible KVC behavior in NSDictionary.m
It makes troubles for me. Please see the code I've sent and WO specifications at
"allValues", "allKeys", and "count" are special cases.
Could you make some tests on MacOSX to see if your code is right or if mine is
right (just adding an object for key
count and see what valueForKey:@"count" give you) ?
My code is:
@implementation NSDictionary (EOKeyValueCoding)
- (id)valueForKey:(NSString *)key
value = [self objectForKey:key];
if ([key isEqualToString:@"allValues"])
else if ([key isEqualToString:@"allKeys"])
else if ([key isEqualToString:@"count"])
value=[NSNumber numberWithInt:[self count]];
If your code is right, we have a big problem: how could we have same foundation
but 2 differents way of processing
depending on what we use (GNUstepWeb/EOF or not)
Manuel Guesdon - OXYMIUM <firstname.lastname@example.org>
14 rue Jean-Baptiste Clement - 93200 Saint-Denis - France
Tel: +33 1 4940 0999 - Fax: +33 1 4940 0998
- KVC bug, Manuel Guesdon, 2002/02/27
- Re: KVC bug, Richard Frith-Macdonald, 2002/02/27
- Re: KVC bug,
Manuel Guesdon <=