From c6826e39b45c4fa88945fa4ccef30158d1fbbd27 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 23 Dec 2016 18:44:19 +0100 Subject: [PATCH] fixed the SPACE_LEFT macro to not underflow, suggested by Axel https://github.com/gphoto/libgphoto2/pull/113 --- camlibs/ptp2/library.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camlibs/ptp2/library.c b/camlibs/ptp2/library.c index cfcdb89ed..75ec47830 100644 --- a/camlibs/ptp2/library.c +++ b/camlibs/ptp2/library.c @@ -5173,7 +5173,7 @@ camera_summary (Camera* camera, CameraText* summary, GPContext *context) txt = summary->text; -#define SPACE_LEFT (summary->text + sizeof (summary->text) - txt) +#define SPACE_LEFT max(0, summary->text + sizeof (summary->text) - txt) #define APPEND_TXT( ... ) txt += snprintf (txt, SPACE_LEFT, __VA_ARGS__) APPEND_TXT (_("Manufacturer: %s\n"),params->deviceinfo.Manufacturer);