From bbc6371dfbf42185cf8545c8cf33276c7ce52fd4 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 19 Apr 2023 16:05:22 -0400 Subject: ustar: Add a couple small comments --- (limited to 'src') 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'; } -- cgit v0.9.1