Mercurial > geeqie
comparison src/exif-common.c @ 1808:6c61c246506b
Fix a small issue with strptime
strptime do not initialize all fields. So the undefined fields could end
in crash later on.
author | mow |
---|---|
date | Sun, 28 Feb 2010 15:17:12 +0000 |
parents | 2cc889b20a9e |
children |
comparison
equal
deleted
inserted
replaced
1807:3a2aff957816 | 1808:6c61c246506b |
---|---|
205 text = exif_get_data_as_text(exif, "Exif.Image.DateTime"); | 205 text = exif_get_data_as_text(exif, "Exif.Image.DateTime"); |
206 if (text) subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTime"); | 206 if (text) subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTime"); |
207 } | 207 } |
208 | 208 |
209 /* Convert the stuff into a tm struct */ | 209 /* Convert the stuff into a tm struct */ |
210 memset(&tm, 0, sizeof(tm)); /* Uh, strptime could let garbage in tm! */ | |
210 if (text && strptime(text, "%Y:%m:%d %H:%M:%S", &tm)) | 211 if (text && strptime(text, "%Y:%m:%d %H:%M:%S", &tm)) |
211 { | 212 { |
212 buflen = strftime(buf, sizeof(buf), "%x %X", &tm); | 213 buflen = strftime(buf, sizeof(buf), "%x %X", &tm); |
213 if (buflen > 0) | 214 if (buflen > 0) |
214 { | 215 { |