summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ustar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ustar.c b/src/ustar.c
index 47e0dfa..d8bd980 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -174,6 +174,8 @@ opkg_opk_ustar_list(struct opkg_opk_ustar *ustar,
if (header.prefix[0] != '\0') {
sprintf((*member)->name, "%s/%s", header.prefix, header.name);
} else {
+ /* Use memcpy() because header.name may not be NUL-terminated.
+ */
memcpy((*member)->name, header.name, sizeof(header.name));
(*member)->name[sizeof(header.name)] = '\0';
}
@@ -282,6 +284,8 @@ opkg_opk_ustar_seek(struct opkg_opk_ustar *ustar,
sprintf(name, "%s/%s", header.prefix,
header.name);
} else {
+ /* Use memcpy() because header.name may not be NUL-
+ * terminated. */
memcpy(name, header.name, sizeof(header.name));
name[sizeof(header.name)] = '\0';
}