Reply to post: Re: question

Get ready to patch Git servers, clients – nasty-looking bugs surface

Mr Flibble

Re: question

So far as I can tell, the allocation of (lengfh+1) bytes for the leafname is fine, as is using strcpy() for that. And yes, size_t or unsigned int should be used.

As for what you're missing: after each addition, check that the new value is greater than the previous value; if not, bail out, raise the alarm, panic, abort() or something. That said, if the lengths are guaranteed to have been checked at the point at which the pathname list was constructed, you can probably get away without that – however, belt and braces…

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon


Biting the hand that feeds IT © 1998–2021