diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-10-22 21:58:21 +0100 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2022-10-23 17:22:56 +0100 |
commit | 836b5b61267e23872f6ce04ed6766c14ecebdf9e (patch) | |
tree | 8145c85dd5cec36a1d4f1eb65b0aa3884f9241e0 /frontends | |
parent | a584c6bb3bc529043e26faed01b61cf56a39d4a7 (diff) | |
download | netsurf-836b5b61267e23872f6ce04ed6766c14ecebdf9e.tar.gz netsurf-836b5b61267e23872f6ce04ed6766c14ecebdf9e.tar.bz2 |
gtk: toolbar: Handle snprintf error
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/gtk/toolbar.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c index be676e210..6ec41cc1d 100644 --- a/frontends/gtk/toolbar.c +++ b/frontends/gtk/toolbar.c @@ -673,15 +673,22 @@ nsgtk_toolbar_customisation_save(struct nsgtk_toolbar *tb) for (location = BACK_BUTTON; location < PLACEHOLDER_BUTTON; location++) { + int written; itemid = itemid_from_location(tb, location); if (itemid == PLACEHOLDER_BUTTON) { /* no more filled locations */ break; } - start += snprintf(start, + written = snprintf(start, orderlen - (start - order), "%s/", tb->items[itemid].name); + if ((written < 0) || + (written >= orderlen - (start - order))) { + free(order); + return NSERROR_UNKNOWN; + } + start += written; if ((start - order) >= orderlen) { break; |