From f203f284d6e15de4a2a12f8788d6e09eb6287334 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 9 Jan 2017 16:19:19 +0100 Subject: [PATCH] Limited exif user comment to 65535 chars --- rtexif/stdattribs.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtexif/stdattribs.cc b/rtexif/stdattribs.cc index 38e7f4b25..ed8f97819 100644 --- a/rtexif/stdattribs.cc +++ b/rtexif/stdattribs.cc @@ -447,12 +447,12 @@ public: { int count = t->getCount(); if(count <= 8) { - return ""; + return std::string(); } - + count = std::min(count, 65535); // limit to 65535 chars to avoid crashes in case of corrupted metadata char *buffer = new char[count - 7]; - if (!strncmp((char*)t->getValue(), "ASCII\0\0\0", 8)) { // TODO: this compares only up to the first \0, remaining \0\0 are ignored + if (!memcmp((char*)t->getValue(), "ASCII\0\0\0", 8)) { strncpy (buffer, (char*)t->getValue() + 8, count - 8); buffer[count - 8] = '\0'; } else {