summaryrefslogtreecommitdiffstats
path: root/libbb
diff options
context:
space:
mode:
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-03-03 19:59:35 (EST)
committer ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-03-03 19:59:35 (EST)
commit81777847f4e745f75504ae1767d49f0711e56b1b (patch)
tree482e59ca6aa8de025411c9de22a0b402fc0c07d6 /libbb
parentda6e2ddf0ea1449b725e0ab9c3a31444e1668613 (diff)
Thanks to Krzysztof Kotlenga <pocek@users.sf.net>:
Frans Meulenbroeks wrote: > Anyway, appending the 0 byte is no good as tar_entry->name[100] is > already out of bounds. http://tiny.cc/964UD looks good enough. It's interesting that we have to trace bugs already fixed upstream years ago. http://lists.linuxtogo.org/pipermail/openembedded-devel/2009-March/008510.html git-svn-id: http://opkg.googlecode.com/svn/trunk@203 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libbb')
-rw-r--r--libbb/unarchive.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libbb/unarchive.c b/libbb/unarchive.c
index 24877e7..84a3b6a 100644
--- a/libbb/unarchive.c
+++ b/libbb/unarchive.c
@@ -600,15 +600,15 @@ file_header_t *get_header_tar(FILE *tar_stream)
linkname = NULL;
} else
#endif
- if (tar.formated.prefix[0] == 0) {
- tar_entry->name = strdup(tar.formated.name);
- } else {
- tar_entry->name = concat_path_file(tar.formated.prefix, tar.formated.name);
- }
+ {
+ tar_entry->name = xstrndup(tar.formated.name, 100);
- if (strlen(tar_entry->name) > 100) {
- tar_entry->name[100] = 0;
- }
+ if (tar.formated.prefix[0]) {
+ char *temp = tar_entry->name;
+ tar_entry->name = concat_path_file(tar.formated.prefix, temp);
+ free(temp);
+ }
+ }
// tar_entry->name = xstrdup(tar.formated.name);