Skip to contentSkip to conversation

Frans Meulenbroeks : opkg: fix bug that occured with file names of exactly 100 chars in the tar file

oe-commits Krzysztof Kotlenga 4 participants 6 messages Mar 3, 2009 – Mar 4, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 8 lines
Module: openembedded.git
Branch: org.openembedded.dev
Commit: 4e1b79d2d824ae7e0204251a09e852c24045c54a
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=4e1b79d2d824ae7e0204251a09e852c24045c54a
Author: Frans Meulenbroeks <[email protected]>
Date:   Wed Feb 11 22:32:06 2009 +0100
Quoted 6 lines

opkg: fix bug that occured with file names of exactly 100 chars in the tar file

---

 packages/opkg/files/opkg_unarchive.patch |   13 +++++++++++++

Hi,
this is actually a new bug, it causes paths in .list files being cut at 99 characters. I've run into this issue when I couldn't find gcc in meta-toolchain.

Signature · 1 line
kjk
#2 lore raw

2009/3/3 Krzysztof Kotlenga <[email protected]>:

Quoted 15 lines
Quoted 8 lines

Module: openembedded.git
Branch: org.openembedded.dev
Commit: 4e1b79d2d824ae7e0204251a09e852c24045c54a
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=4e1b79d2d824ae7e0204251a09e852c24045c54a

Author: Frans Meulenbroeks <[email protected]>
Date:   Wed Feb 11 22:32:06 2009 +0100

Quoted 6 lines

opkg: fix bug that occured with file names of exactly 100 chars in the tar file

---

 packages/opkg/files/opkg_unarchive.patch |   13 +++++++++++++

Quoted 8 lines

Hi,
this is actually a new bug, it causes paths in .list files being cut at 99 characters. I've run into this issue when I couldn't find gcc in meta-toolchain.

--
kjk

I don't have time today to look into this (all day & evening hooked up at work). Probably tomorrow.
Anyway, appending the 0 byte is no good as tar_entry->name[100] is already out of bounds.

For now I suggest undoing my patch. I'll come up with a better solution a.s.a.p. Guess this needs to be fixed at the place where tar_entry->name is used (the issue was that this array was 100 bytes and got followed by the mode (.e.g 000644), so without my patch you got files like:
.....xml000644). this happens if the file name is exactly 100 chars

Apologies for any inconvenience.

Frans

#3 lore raw
Quoted 2 lines · Frans Meulenbroeks

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.

Signature · 1 line
kjk
unarchive.c +8 -8
Index: libbb/unarchive.c
===================================================================
@@ -600,16 +600,16 @@
                 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 (tar.formated.prefix[0]) {
+                        char *temp = tar_entry->name;
+                        tar_entry->name = concat_path_file(tar.formated.prefix, temp);
+                        free(temp);
+                }
         }
 
-	if (strlen(tar_entry->name) > 100) {
-		tar_entry->name[100] = 0;
-	}
-
 	// tar_entry->name = xstrdup(tar.formated.name);
 
 /*
#4 lore raw

Hi kjk,
Thanks, patch applied as R203

Regards,
Tick

2009/3/4 Krzysztof Kotlenga <[email protected]>:

Quoted 16 lines
Quoted 2 lines · Frans Meulenbroeks

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.

--
kjk
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#5 lore raw
Quoted 2 lines · Tick

Hi kjk,
Thanks, patch applied as R203

Thanks Tick.
Since Koen has bumped opkg SRCREV to r203, now we have one problem
left: opkg_unarchive.patch has to be disabled/removed. Otherwise it breaks what was fixed here.

Signature · 1 line
kjk
#6 lore raw
Quoted 9 lines · Krzysztof Kotlenga
Quoted 2 lines · Tick

Hi kjk,
Thanks, patch applied as R203

Thanks Tick.
Since Koen has bumped opkg SRCREV to r203, now we have one problem
left: opkg_unarchive.patch has to be disabled/removed. Otherwise it breaks what was fixed here.

Oops, forgot to commit that bit, sorry. It's in now.

regards,

Koen