Merge "Handle locations with more than 30 chars for lat/lon."
diff --git a/gpsinfo.c b/gpsinfo.c
index 896ad28..2661e52 100644
--- a/gpsinfo.c
+++ b/gpsinfo.c
@@ -187,7 +187,7 @@
 
         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 @@
                     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 @@
 
 #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 @@
 
     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;