[parted-devel] [PATCH 84/86] Fix the length of several strncpy calls

Phillip Susi psusi at ubuntu.com
Tue Jul 24 14:15:44 BST 2018


On 7/23/2018 8:26 PM, Brian C. Lane wrote:
> These need to be 1 less than the allocated size of the buffer, strncpy
> will fill the remainder with zeros, but there needs to be room for at
> least one 0x00 at the end.

strncpy doesn't fill the remainder with zeros, and if it runs out of
space, leaves the string unterminated, so you have to manually set the
last byte of the buffer to zero.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/parted-devel/attachments/20180724/ce039477/attachment.sig>


More information about the parted-devel mailing list