[Live-devel] [patch] make sure string storage has enough room for the null char

Ross Finlayson finlayson at live555.com
Tue Jul 8 18:06:32 PDT 2008


>This patch is the one I am least comfortable with. I have no idea if the
>strings that are being created require a null char to terminate them.
>But to stimulate discussion I am posting the patches that do make sure
>there is room for the null char in a few strings where it seems it was
>no accounted for.

The existing code in each case was actually OK, because the format 
string contained sufficient extra characters (e.g., "%s") to allow 
sufficient space for the trailing '\0' character when you do the 
"sprintf()".  However, because this still triggered your checking 
tools (and is a bit of a hack anyway), I went ahead and made your 
suggested changes (to add 1 to the buffer size).
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list