From: zunda Subject: Avoid returning random string value for an EXIF tag not present * exif.c: Added a check whether the tag is found to rb_exif_get_tag(). exif_entry_get_value() never returns NULL. --- a/exif.c +++ b/exif.c @@ -214,7 +214,6 @@ Exif *exif; ExifTag tag; ExifEntry *e; - const char *found; int i; char value[1024]; @@ -250,8 +249,11 @@ if (e) break; } - found = exif_entry_get_value(e, value, sizeof(value)); - return found ? rb_str_new2(found) : Qnil; + if (e){ + exif_entry_get_value(e, value, sizeof(value)); + return rb_str_new2(value); + } + return Qnil; } static void