From: Klas Lindfors Date: Tue, 4 Dec 2012 19:15:44 +0000 (+0100) Subject: use sizeof() on the static string instead of strlen() X-Git-Tag: v1.10.0~9 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9ef9f2d9bdfd3eeedfd33e56c3666640614f649;p=yubikey-personalization use sizeof() on the static string instead of strlen() --- diff --git a/tests/test_args_to_config.c b/tests/test_args_to_config.c index fe0a9df..87e84ae 100644 --- a/tests/test_args_to_config.c +++ b/tests/test_args_to_config.c @@ -118,7 +118,7 @@ int _test_config (YKP_CONFIG *cfg, YK_STATUS *st, int argc, char **argv) unsigned char usb_mode = -1; bool zap = false; - unsigned char scan_map[strlen(SCAN_MAP)]; + unsigned char scan_map[sizeof(SCAN_MAP)]; int rc; @@ -299,7 +299,7 @@ int _test_non_config_args(void) unsigned char usb_mode = -1; bool zap = false; - unsigned char scan_map[strlen(SCAN_MAP)]; + unsigned char scan_map[sizeof(SCAN_MAP)]; char *argv[] = { "unittest", "-1", "-sout", "-iin", "-c313233343536", "-y", "-v", diff --git a/ykpersonalize.c b/ykpersonalize.c index a130b67..3491c7e 100644 --- a/ykpersonalize.c +++ b/ykpersonalize.c @@ -58,7 +58,7 @@ int main(int argc, char **argv) bool aesviahash = false; bool use_access_code = false; unsigned char access_code[256]; - unsigned char scan_codes[strlen(SCAN_MAP)]; + unsigned char scan_codes[sizeof(SCAN_MAP)]; YK_KEY *yk = 0; YKP_CONFIG *cfg = ykp_alloc(); YK_STATUS *st = ykds_alloc();