1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2025-02-12 15:54:18 +01:00

ykpamcfg: Use snprintf() instead of strncpy()

strncpy() is _NOT_ a safe version of strcpy() and it should not be used
(ineffective and dangerous since a NUL termination might be missing).
Instead snprintf() the way to safely construct a string with a given
limit. This commit implements this for the action parsing in ykpamcfg.
This commit is contained in:
Karol Babioch 2018-05-04 16:32:16 +02:00
parent a7c1d0adfd
commit 66265a3343

View File

@ -105,7 +105,7 @@ parse_args(int argc, char **argv,
*slot = 2; *slot = 2;
break; break;
case 'A': case 'A':
strncpy(*action, optarg, ACTION_MAX_LEN); snprintf(*action, ACTION_MAX_LEN, "%s", optarg);
break; break;
case 'p': case 'p':
*output_dir = optarg; *output_dir = optarg;