projects
/
platform
/
upstream
/
libexif.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d40a4bc
)
handle non-0 terminated value returns as failure
author
Marcus Meissner
<marcus@jet.franken.de>
Sat, 2 Feb 2019 18:04:59 +0000
(19:04 +0100)
committer
Marcus Meissner
<marcus@jet.franken.de>
Sat, 2 Feb 2019 18:05:25 +0000
(19:05 +0100)
test/test-fuzzer.c
patch
|
blob
|
history
diff --git
a/test/test-fuzzer.c
b/test/test-fuzzer.c
index
d72f6d1
..
2af7288
100644
(file)
--- a/
test/test-fuzzer.c
+++ b/
test/test-fuzzer.c
@@
-34,9
+34,12
@@
void content_foreach_func(ExifEntry *entry, void *callback_data);
void content_foreach_func(ExifEntry *entry, void *UNUSED(callback_data))
{
void content_foreach_func(ExifEntry *entry, void *callback_data);
void content_foreach_func(ExifEntry *entry, void *UNUSED(callback_data))
{
- char buf[200
0
];
+ char buf[200
1
];
- exif_entry_get_value(entry, buf, sizeof(buf));
+ /* ensure \0 */
+ buf[sizeof(buf)-1] = 0;
+ buf[sizeof(buf)-2] = 0;
+ exif_entry_get_value(entry, buf, sizeof(buf)-1);
printf(" Entry %p: %s (%s)\n"
" Size, Comps: %d, %d\n"
" Value: %s\n",
printf(" Entry %p: %s (%s)\n"
" Size, Comps: %d, %d\n"
" Value: %s\n",
@@
-45,7
+48,8
@@
void content_foreach_func(ExifEntry *entry, void *UNUSED(callback_data))
exif_format_get_name(entry->format),
entry->size,
(int)(entry->components),
exif_format_get_name(entry->format),
entry->size,
(int)(entry->components),
- exif_entry_get_value(entry, buf, sizeof(buf)));
+ exif_entry_get_value(entry, buf, sizeof(buf)-1));
+ if (buf[sizeof(buf)-2] != 0) abort();
}
}