X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fopt%2Fhelpers.c;h=e657ebff8727090c676e7e594520855fa208de89;hp=e96f5db81ebf9df3c9af2d646875aa944b1d21ff;hb=b61b4b2f2c257b6e776772794969ee8526e132a8;hpb=9056c31b46452c92c7dd9c276664f514720a84c6 diff --git a/ccan/opt/helpers.c b/ccan/opt/helpers.c index e96f5db8..e657ebff 100644 --- a/ccan/opt/helpers.c +++ b/ccan/opt/helpers.c @@ -147,6 +147,8 @@ void opt_show_charp(char buf[OPT_SHOW_LEN], char *const *p) len = OPT_SHOW_LEN - 2; strncpy(buf+1, *p, len); buf[1+len] = '"'; + if (len < OPT_SHOW_LEN - 2) + buf[2+len] = '\0'; } /* Set an integer value, various forms. Sets to 1 on arg == NULL. */