diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2012-06-08 08:16:50 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-08 08:16:50 -0700 |
commit | 47ca30a9f5cf29543c9eb0b7bcde4457afd4982c (patch) | |
tree | 8e3d591e5dc8280c665031265269a3c4aa3cc134 | |
parent | 8f596c1ee240583a15ef3de2b400b0197a146bbf (diff) | |
parent | 2671ba8c47ffc40ae16b0861cd59547666147758 (diff) | |
download | jhead-47ca30a9f5cf29543c9eb0b7bcde4457afd4982c.tar.gz |
am 2671ba8c: Merge "Handle locations with more than 30 chars for lat/lon."
* commit '2671ba8c47ffc40ae16b0861cd59547666147758':
Handle locations with more than 30 chars for lat/lon.
-rw-r--r-- | gpsinfo.c | 6 | ||||
-rw-r--r-- | jhead.h | 9 |
2 files changed, 10 insertions, 5 deletions
@@ -187,7 +187,7 @@ void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned char switch(Tag){ char FmtString[21]; - char TempString[50]; + char TempString[MAX_BUF_SIZE]; double Values[3]; case TAG_GPS_LAT_REF: @@ -237,9 +237,9 @@ void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned char Get32s(8+(char*)ValuePtr), Get32s(12+(char*)ValuePtr), Get32s(16+(char*)ValuePtr), Get32s(20+(char*)ValuePtr)); if (Tag == TAG_GPS_LAT){ - strncpy(ImageInfo.GpsLatRaw, TempString, 31); + strncpy(ImageInfo.GpsLatRaw, TempString, MAX_BUF_SIZE); }else{ - strncpy(ImageInfo.GpsLongRaw, TempString, 31); + strncpy(ImageInfo.GpsLongRaw, TempString, MAX_BUF_SIZE); } break; @@ -61,6 +61,11 @@ extern int DumpExifMap; #define MAX_DATE_COPIES 10 +// Buffer size must large enough to hold maximum location string +// containing six signed integers plus delimeters and terminator, +// i.e.: 11 * 6 + 3(‘/’) + 2(’,’) + 1(\0) = 72 +#define MAX_BUF_SIZE 72 + typedef struct { uint32_t num; uint32_t denom; @@ -114,10 +119,10 @@ typedef struct { int GpsInfoPresent; char GpsLat[31]; - char GpsLatRaw[31]; + char GpsLatRaw[MAX_BUF_SIZE]; char GpsLatRef[2]; char GpsLong[31]; - char GpsLongRaw[31]; + char GpsLongRaw[MAX_BUF_SIZE]; char GpsLongRef[2]; char GpsAlt[20]; rat_t GpsAltRaw; |