summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2012-06-08 08:02:15 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-06-08 08:02:15 -0700
commit2671ba8c47ffc40ae16b0861cd59547666147758 (patch)
tree20f78c1c70b33019fcc73b60b7595ad5e36fd0b8
parent754078052c687f6721536009c816644c73e4f145 (diff)
parent2bfc190bd3be7e1b91fe3d7ca49412ebf0f5ceee (diff)
downloadjhead-ics-plus-aosp.tar.gz
Merge "Handle locations with more than 30 chars for lat/lon."android-sdk-adt_r20tools_r20ics-plus-aosp
-rw-r--r--gpsinfo.c6
-rw-r--r--jhead.h9
2 files changed, 10 insertions, 5 deletions
diff --git a/gpsinfo.c b/gpsinfo.c
index 896ad28..2661e52 100644
--- a/gpsinfo.c
+++ b/gpsinfo.c
@@ -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;
diff --git a/jhead.h b/jhead.h
index 4347fe8..a73c578 100644
--- a/jhead.h
+++ b/jhead.h
@@ -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;