Message ID | 20200501154819.2984-1-michael-dev@fami-braun.de |
---|---|
State | Accepted |
Delegated to: | Pablo Neira |
Headers | show |
Series | [1/3] main: fix ASAN -fsanizize=address error | expand |
Applied, thanks.
diff --git a/src/main.c b/src/main.c index 3dc6b62c..d213c601 100644 --- a/src/main.c +++ b/src/main.c @@ -124,10 +124,10 @@ static const char *get_optstring(void) size_t i, j; optstring[0] = '+'; - for (i = 0, j = 1; i < NR_NFT_OPTIONS; i++) - j += sprintf(optstring + j, "%c%s", - nft_options[i].val, - nft_options[i].arg ? ":" : ""); + for (i = 0, j = 1; i < NR_NFT_OPTIONS && j < sizeof(optstring); i++) + j += snprintf(optstring + j, sizeof(optstring) - j, "%c%s", + nft_options[i].val, + nft_options[i].arg ? ":" : ""); } return optstring; }