From 5f2dd7f6d79f7e0d11012d2f85b68c774c6e95ee Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 23 Nov 2017 16:43:24 +0100 Subject: Avoid truncation with snprintf Just something that came from new compiler warnings after upgrading my system. --- src/dw-hdfsee.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/dw-hdfsee.c') diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index c943cfdf..c1bb39cc 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -2626,9 +2626,12 @@ static void calibmode_press(DisplayWindow *dw, GdkEventButton *event) if ( revmap_return_value == 0 ) { fs = dfs; ss = dss; - snprintf(statusbar_string, 80, - "Last clicked position: x: %i, y: %i, fs: %u, ss: %u," - " (panel %s)", x, y, fs, ss, p->name); + if ( snprintf(statusbar_string, 80, + "Last clicked position: x: %i, y: %i, fs: %u, ss: %u," + " (panel %s)", x, y, fs, ss, p->name) != 0 ) + { + ERROR("Panel name is too long for status bar.\n"); + } } gtk_statusbar_push(GTK_STATUSBAR(dw->statusbar), cc, statusbar_string); } -- cgit v1.2.3