aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/util.h4
-rw-r--r--lib/util/alloc.c12
-rw-r--r--mkfs/dirscan.c2
3 files changed, 1 insertions, 17 deletions
diff --git a/include/util.h b/include/util.h
index e7bc431..481ea1f 100644
--- a/include/util.h
+++ b/include/util.h
@@ -113,10 +113,6 @@ void *alloc_flex(size_t base_size, size_t item_size, size_t nmemb);
SQFS_INTERNAL
void *alloc_array(size_t item_size, size_t nmemb);
-/* allocates len + 1 (for the null-terminator) and does overflow checking */
-SQFS_INTERNAL
-void *alloc_string(size_t len);
-
/*
Convert back to forward slashed, remove all preceeding and trailing slashes,
collapse all sequences of slashes, remove all path components that are '.'
diff --git a/lib/util/alloc.c b/lib/util/alloc.c
index 924f8e8..da99d01 100644
--- a/lib/util/alloc.c
+++ b/lib/util/alloc.c
@@ -36,15 +36,3 @@ void *alloc_array(size_t item_size, size_t nmemb)
return calloc(1, size);
}
-
-void *alloc_string(size_t len)
-{
- size_t size;
-
- if (SZ_ADD_OV(len, 1, &size)) {
- errno = EOVERFLOW;
- return NULL;
- }
-
- return calloc(1, size);
-}
diff --git a/mkfs/dirscan.c b/mkfs/dirscan.c
index e33e6f7..6d6b745 100644
--- a/mkfs/dirscan.c
+++ b/mkfs/dirscan.c
@@ -150,7 +150,7 @@ static int populate_dir(fstree_t *fs, tree_node_t *root, dev_t devstart,
continue;
if (S_ISLNK(sb.st_mode)) {
- extra = alloc_string(sb.st_size);
+ extra = calloc(1, sb.st_size + 1);
if (extra == NULL)
goto fail_rdlink;