From 63f902e995780463b5805f0721d7db0be7a2cbab Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 21 Feb 2011 21:25:47 +0000 Subject: [PATCH] Fix bug #3188385: ensure that options_snoptionf terminates its output svn path=/trunk/netsurf/; revision=11749 --- desktop/options.c | 4 ++++ 1 file changed, 4 insertions(+) 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; }