--- minolta.c.orig Fri May 11 19:03:30 2012 +++ minolta.c Sat Jul 12 19:40:37 2014 @@ -484,10 +484,10 @@ minolta_cprop(struct exifprop *prop, unsigned char *of aprop->str = valbuf; valbuf = NULL; if (aprop->value != 6) - snprintf(aprop->str, 15, "%+0.1f EV", + snprintf(aprop->str, 16, "%+0.1f EV", ((double)aprop->value - 6) / 3); else - snprintf(aprop->str, 15, "Normal"); + snprintf(aprop->str, 16, "Normal"); break; /* Camera model (saved for 7Hi stupidity). */ @@ -501,7 +501,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of case 18: aprop->str = valbuf; valbuf = NULL; - snprintf(aprop->str, 15, "%02f", + snprintf(aprop->str, 16, "%02f", (double)aprop->value / 256); break; @@ -512,7 +512,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of case 30: aprop->str = valbuf; valbuf = NULL; - snprintf(aprop->str, 15, "%0.6f", + snprintf(aprop->str, 16, "%0.6f", (double)aprop->value / 256); break; @@ -523,7 +523,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of valbuf = NULL; v = (u_int16_t)(pow(2, ((double)aprop->value / 8) - 1) * (double)3.125); - snprintf(aprop->str, 15, "%d", v); + snprintf(aprop->str, 16, "%d", v); break; /* Aperture and max aperture. */ @@ -533,7 +533,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of aprop->str = valbuf; valbuf = NULL; d = pow(2, ((double)aprop->value / 16) - 0.5); - snprintf(aprop->str, 15, "%0.1f", d); + snprintf(aprop->str, 16, "%0.1f", d); break; /* Exposure time. */ @@ -546,9 +546,9 @@ minolta_cprop(struct exifprop *prop, unsigned char *of /* 1 sec limit. */ if (aprop->value < 56) - snprintf(aprop->str, 15, "%0.1f", d); + snprintf(aprop->str, 16, "%0.1f", d); else - snprintf(aprop->str, 15, "1/%d", + snprintf(aprop->str, 16, "1/%d", (unsigned int)d); #if 0 /* @@ -568,9 +568,9 @@ minolta_cprop(struct exifprop *prop, unsigned char *of aprop->str = valbuf; valbuf = NULL; if (!aprop->value) - strcpy(aprop->str, "Infinite"); + strlcpy(aprop->str, "Infinite", 16); else - snprintf(aprop->str, 15, "%.1f", + snprintf(aprop->str, 16, "%.1f", (float)(aprop->value / (float)1000)); aprop->value /= 100; break; @@ -587,7 +587,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of aprop->str = valbuf; valbuf = NULL; byte4exif(aprop->value, buf, LITTLE); - snprintf(aprop->str, 15, "%02d/%02d/%04d", + snprintf(aprop->str, 16, "%02d/%02d/%04d", buf[0], buf[1], buf[3] << 8 | buf[2]); break; @@ -597,7 +597,7 @@ minolta_cprop(struct exifprop *prop, unsigned char *of aprop->str = valbuf; valbuf = NULL; byte4exif(aprop->value, buf, LITTLE); - snprintf(aprop->str, 9, "%02d:%02d:%02d", + snprintf(aprop->str, 16, "%02d:%02d:%02d", buf[2], buf[1], buf[0]); break; @@ -631,9 +631,9 @@ minolta_cprop(struct exifprop *prop, unsigned char *of valbuf = NULL; aprop->value -= 3; if (aprop->value) - snprintf(aprop->str, 15, "%+d", aprop->value); + snprintf(aprop->str, 16, "%+d", aprop->value); else - strcpy(aprop->str, "Normal"); + strlcpy(aprop->str, "Normal", 16); break; /* Scene. */ @@ -663,7 +663,7 @@ minolta_naval(struct exifprop *props, struct exiftag * free(prop->str); prop->str = NULL; exifstralloc(&prop->str, strlen(na) + 1); - strcpy(prop->str, na); + strlcpy(prop->str, na, (strlen(na) + 1)); if (!(prop->lvl & ED_UNK)) prop->lvl = ED_VRB; }