Skip navigation.
 
mlRe: Newbie question: error in creating a NSData object using handle(Resource Management)
FROM : Jens Alfke
DATE : Wed Jun 25 22:37:58 2008

>  Handle dataHandle = Get1IndResource( type1, n);
>  ....


I hope you checked that dataHandle!=NULL and *dataHandle!=NULL.

>  struct A_STRUCT aStruct;
>  memcpy(& aStruct,[data bytes], [data length]);


This is dangerous —  if [data length] is larger than sizeof(aStruct), 
you've just clobbered your stack. If it's smaller, you've left part of 
aStruct uninitialized with garbage bytes in it. Either of those 
situations is likely to cause a crash, especially the former because 
it can very easily be abused by hackers to take control of your app.

> After several times looping through the list, I got an error in the 
> line
> above.


What error, specifically? How are we supposed to tell you how to 
correct the error if you won't tell us what it is?!

—Jens_______________________________________________

Cocoa-dev mailing list (<email_removed>)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mlRE: Newbie question: error in creating a NSData object using handle(Resource Management) Gary L. Wade Jun 25, 21:13
mlRe: Newbie question: error in creating a NSData object using handle(Resource Management) Jens Alfke Jun 25, 22:37