diff options
author | Tim Ruffing <crypto@timruffing.de> | 2022-08-24 12:22:48 +0200 |
---|---|---|
committer | mvp <mvp@users.noreply.github.com> | 2022-08-24 15:59:01 -0700 |
commit | 88e5641fe13220cbb2772417377ae0c5fd6c1033 (patch) | |
tree | 5080bf8cb7218eec5554944e2ea247eb6bef8e1d | |
parent | b51b5addeebb88ec4e7b8e85ae8d74ef4d13cabf (diff) |
Make sure option strings are null-terminated
-rw-r--r-- | uhubctl.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -919,16 +919,16 @@ int main(int argc, char *argv[]) printf("\n"); break; case 'l': - strncpy(opt_location, optarg, sizeof(opt_location)); + snprintf(opt_location, sizeof(opt_location), "%s", optarg); break; case 'L': opt_level = atoi(optarg); break; case 'n': - strncpy(opt_vendor, optarg, sizeof(opt_vendor)); + snprintf(opt_vendor, sizeof(opt_vendor), "%s", optarg); break; case 's': - strncpy(opt_search, optarg, sizeof(opt_search)); + snprintf(opt_search, sizeof(opt_search), "%s", optarg); break; case 'p': if (!strcasecmp(optarg, "all")) { /* all ports is the default */ |