diff --git a/desktop/options.c b/desktop/options.c index 091a3b9e5..3ead9be11 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -633,6 +633,10 @@ int options_snoptionf(char *string, size_t size, unsigned int option, fmtc++; } } + + /* Ensure that we NUL-terminate the output */ + string[min(slen, size - 1)] = '\0'; + return slen; }