Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6713957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:26:25+00:00 2026-05-26T08:26:25+00:00

Sometimes when trying to get a path to a keychain returned by SecKeychainCopySearchList I

  • 0

Sometimes when trying to get a path to a keychain returned by SecKeychainCopySearchList I get error with code -25301 which from the list of errors stands for errSecBufferTooSmall. The SecCopyErrorMessageString states:

There is not enough memory available to use the specified item.

Weird thing is that it doesn’t always return the error on the very same keychain reference.

Here’s how I try to get the path to the keychain:

- (NSString *)getKeychainPath:(SecKeychainRef)keychain {
    char *pathName = malloc(sizeof(*pathName) * 1024);
    UInt32 pathLength;
    OSStatus errCode = SecKeychainGetPath(keychain, &pathLength, pathName);
    if (errCode != errSecSuccess) {
        NSString *errString = (NSString *)SecCopyErrorMessageString(errCode, NULL);
        DLog(@"%d: %@", errCode, errString);
    }
    NSData *d = [NSData dataWithBytes:pathName length:pathLength];
    return [[[NSString alloc] initWithData:d encoding:NSUTF8StringEncoding] autorelease];
}

I’m interested in what buffer does the function use? I’ve tried outputting the pathLength variable but it’s way bellow the 1K bytes. What am I doing wrong? What should I do to avoid these errors? Can they be bypassed by any way at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:26:26+00:00Added an answer on May 26, 2026 at 8:26 am

    From the SecKeychainGetPath documentation:

    ioPathLength

    On entry, a pointer to a variable containing the length (in bytes) of the buffer specified by pathName.
    On return, the string length of pathName, not including the null termination.

    You’re not doing the “on input” part. You need to initialize pathLength to the size of the pathName buffer. For example:

    UInt32 pathLength = 1024;
    char *pathName = malloc(pathLength);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes I still get stuck trying to translate procedural code into functional code. Is
Sometimes when trying to get the Latitude span or Longitude span of a mapview
I'm trying to get a query working that takes the values (sometimes just the
I'm trying to make my C# application multi threaded because sometimes, I get an
I am trying to get some data from remote server. To achieve this I
I am trying to get the search keyword from a referrer url. Currently, I
I am trying to get the below code to call to a PHP file,
i'm trying to get all the images from a facebook group using facebook API
I am trying to get the correct formatting of results back from a Mysql
I am trying to get the IClass values from registry key using RegQueryVaueEx and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.