summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Ruffing <crypto@timruffing.de>2022-08-24 12:22:48 +0200
committermvp <mvp@users.noreply.github.com>2022-08-24 15:59:01 -0700
commit88e5641fe13220cbb2772417377ae0c5fd6c1033 (patch)
tree5080bf8cb7218eec5554944e2ea247eb6bef8e1d
parentb51b5addeebb88ec4e7b8e85ae8d74ef4d13cabf (diff)
Make sure option strings are null-terminated
-rw-r--r--uhubctl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/uhubctl.c b/uhubctl.c
index 0321972..67c7fcb 100644
--- a/uhubctl.c
+++ b/uhubctl.c
@@ -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 */