summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2016-12-23 18:44:19 +0100
committerMarcus Meissner <marcus@jet.franken.de>2016-12-23 18:44:19 +0100
commitc6826e39b45c4fa88945fa4ccef30158d1fbbd27 (patch)
tree71eb9e84b9a402bc333c64bb49008df3c7457601
parent4652791d91e4ca11a71f6c737e5bff8de6f36471 (diff)
downloadlibgphoto2-c6826e39b45c4fa88945fa4ccef30158d1fbbd27.tar.gz
fixed the SPACE_LEFT macro to not underflow, suggested by Axel
https://github.com/gphoto/libgphoto2/pull/113
-rw-r--r--camlibs/ptp2/library.c2
1 files changed, 1 insertions, 1 deletions
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);