lcp / mokutil

The utility to manipulate machine owner keys
GNU General Public License v3.0
67 stars 37 forks source link

generate_hash() / generate_pw_hash(): don't use strlen() for strncpy … #15

Closed vathpela closed 6 years ago

vathpela commented 6 years ago

…bounds

New gcc rightly comlplains when we do the following:

strncpy (dest, src, strlen(src));

For two reasons: a) it doesn't copy the NUL byte b) it's otherwise the same thing strcpy() would have done

This patch replaces that with stpncpy (just because it's slightly easier to use) and the real bounds for the destination.

Signed-off-by: Peter Jones pjones@redhat.com