bengottlieb / Twitter-OAuth-iPhone

An easy way to get Twitter authenticating with OAuth on iPhone
http://www.standalone.com
799 stars 155 forks source link

Unsafe use of strstr() on non-null-terminated string #93

Open newacct opened 12 years ago

newacct commented 12 years ago

In [SA_OAuthTwitterController webView:shouldStartLoadWithRequest:navigationType:], you get the bytes from an NSData using [data bytes], and then in the next line you proceed to use strstr() on it. However, strstr() requires that its arguments are null-terminated, and there is no guarantee that the bytes you get from [NSData bytes] are null-terminated. If the substring is not found, it will run off the end of the buffer.