From: Leandro Dorileo Date: Thu, 15 Jan 2015 13:23:36 +0000 (-0200) Subject: jpeg: fix non null-terminated string issue X-Git-Tag: release_0.5.0~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=897b70def4bb8cabd3c6eb7c01a53206310d5039;p=platform%2Fupstream%2Flightmediascanner.git jpeg: fix non null-terminated string issue Pointed out by coverity tests: https://bugs.tizen.org/jira/browse/TC-2097 --- diff --git a/src/plugins/jpeg/jpeg.c b/src/plugins/jpeg/jpeg.c index 2597e28..12d7624 100644 --- a/src/plugins/jpeg/jpeg.c +++ b/src/plugins/jpeg/jpeg.c @@ -473,7 +473,7 @@ static int _exif_data_get(int fd, int len, struct lms_image_info *info) { const unsigned char exif_hdr[6] = "Exif\0"; - unsigned char buf[8]; + unsigned char buf[9]; unsigned int little_endian, offset, count; off_t abs_offset, tiff_base; @@ -498,6 +498,7 @@ _exif_data_get(int fd, int len, struct lms_image_info *info) perror("read"); return -4; } + buf[sizeof(buf) -1] = '\0'; if (buf[0] == 'I' && buf[1] == 'I') { little_endian = 1;