summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-19 16:05:22 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-19 16:05:22 (EDT)
commitbbc6371dfbf42185cf8545c8cf33276c7ce52fd4 (patch)
tree34d481ab10a04f694422d33238e397df0cf4a268 /src
parent6812b9d2cde1479cd32237e3743ed4b4d26d7a2b (diff)
ustar: Add a couple small comments
Diffstat (limited to 'src')
-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';
}