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 8701567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:25:53+00:00 2026-06-13T02:25:53+00:00

Apple’s Secure Coding Guide documentation provides guidance on: format string attacks buffer overflows What

  • 0

Apple’s Secure Coding Guide documentation provides guidance on:

  • format string attacks
  • buffer overflows

What is not clear (to me, anyway) is how to prevent format string attacks and buffer overruns when using NSString.

How do I go about defending against such attacks?
Are there any categories I can apply to protect against this?
Is there a “secure” NSString equivalent I can use?

  • 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-06-13T02:25:55+00:00Added an answer on June 13, 2026 at 2:25 am

    Buffer overruns are generally not a problem when you are putting data into an NSString (or an NSMutableString), because when you create an NSString, you have to tell it how much data you are giving it, and it automatically allocates enough private storage to hold what you give it. Just stick to the published APIs and don’t try any shenanigans like casting away const from a pointer returned by UTF8String and writing through the pointer.

    Note that NSMutableData, unlike NSMutableString, provides the mutableBytes message, which returns a pointer to memory that you are allowed to write to. So if you’re using that API, you do have to be careful about buffer overruns.

    For format strings, you just have to follow the advice in that document. For example, never pass data from an untrusted source as the format argument, or even as part of the format argument. Generally your format strings should either be string literals or they should be returned from NSLocalizedString.

    There’s no “secure” version of NSString.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apple provides documentation for managing user preferences through both Core Foundation and Foundation Kit
Apple does say in the documentation about the fact that they do not want
Apple really had bad documentation about how the provider connects and communicates to their
Apple uses modal often in their documentation. Like dismissModalViewController in their titles of methods,
Apple's documentation for UIDocumentInteractionController presentOpenInMenuFromBarButtonItem:animated: method states that If there are no registered apps
Apple doesn’t seem to offer downloads of older versions of Safari, and I’m not
Apple's multithreading docs don't list NSIndexPath as threadsafe or not! As an immutable class,
Apple's documentation about the new iOS smart banners feature in mobile Safari talks about
Apple GameKit doc says: Bluetooth networking is not supported on the original iPhone. What
Apple strongly recommends using the binary plist format when reading large XML-based data sets

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.