Den 20-08-2012 18:39, Bart Van Assche skrev: > My arguments are: > - It's considered a good programming practice to terminate strings > properly that are announced as '\0'-terminated.
SNMP OCTET STRINGS are not C strings, they are completely different beasts. They should not be confused. > - strlcpy() is more efficient than strncpy(). strncpy() fills all > trailing bytes in the destination string with '\0' characters while > strlcpy() writes only one terminating '\0' (see e.g. > http://pubs.opengroup.org/onlinepubs/7908799/xsh/strncpy.html). This is a surprise to me, I wonder who invented this (mis)feature. But I am willing to live without this micro-optimization > - If truncating a string is considered improper, strdup() should be used > instead of strncpy() or strlcpy(). This is a fixed size buffer in the struct, and its max size is given by the MIB. /Niels -- Niels Baggesen - @home - Ã…rhus - Denmark - n...@users.sourceforge.net The purpose of computing is insight, not numbers --- R W Hamming ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders