Re: SecKeychainFindGenericPassword
Re: SecKeychainFindGenericPassword
- Subject: Re: SecKeychainFindGenericPassword
- From: Parrish Myers <email@hidden>
- Date: Sat, 3 Sep 2005 13:37:25 -0700
Thanks... that should work beautifully!
On 9/3/05, Ryan Britton <email@hidden> wrote:
>
> I don't know, but I would assume not, so I just allocated a buffer 1
> larger and copied it into that in order to null-terminate it.
> buffer = (char *) malloc((passwordLength + 1) * sizeof(char));
>
> strncpy(buffer, passwordData, passwordLength);
> buffer[passwordLength] = 0;
>
> password = [NSString stringWithUTF8String:buffer];
>
> free(buffer);
>
>
>
> On Sep 3, 2005, at 1:17 PM, Parrish Myers wrote:
>
> Is it safe to assume that the memory allocated for the password is 1
> larger
> than the size reported? If not, I am just stomping on some other piece of
> memory.
>
> On 9/3/05, Ryan Britton <email@hidden> wrote:
>
>
> I ran into this same problem a few days ago. The buffer it gives you
> is not null-terminated, which stringWithUTF8String: expects, so you
> need to handle that part yourself.
>
>
>
> On Sep 3, 2005, at 12:58 PM, Parrish Myers wrote:
>
>
> Hello,
>
> I have been tring to create an application that uses the keychain
> services. It seems that when I pick a password that is 3 characters
> or less (in spite of security reasons) the function
> "SecKeychainFindGenericPassword" will return a password that is 4
> characters. The size return correctly states the size, but when the
> string is passed to "[NSString stringWithUTF8String:] it picks up a
> string that is of size 4. The other characters in the string are
> obviously crap, and my authentication fails. Does this mean that
> there is a bug in "SecKeychainFindGenericPassword" or am I simply
> initializing the NSString incorrectly. There seems to be no NSString
> initialization function that is not depreciated that takes size.
>
> Does anyone know how to solve this?
>
> Thanks
> Parrish
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden