[hackers] [sbase] tar: check if allocation failed || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Sun, 18 Jul 2021 19:57:48 +0200 (CEST)

commit 61be841f5cc4019890c769cec33744616614ea10
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sat Jul 17 21:04:04 2021 +0200
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Sun Jul 18 10:53:51 2021 -0700

    tar: check if allocation failed

diff --git a/tar.c b/tar.c
index b74c134..d3a9f3b 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -78,8 +78,8 @@ static const char *filtertools[] = {
 static void
 pushdirtime(char *name, time_t mtime)
 {
- dirtimes = reallocarray(dirtimes, dirtimeslen + 1, sizeof(*dirtimes));
- dirtimes[dirtimeslen].name = strdup(name);
+ dirtimes = ereallocarray(dirtimes, dirtimeslen + 1, sizeof(*dirtimes));
+ dirtimes[dirtimeslen].name = estrdup(name);
         dirtimes[dirtimeslen].mtime = mtime;
         dirtimeslen++;
 }
Received on Sun Jul 18 2021 - 19:57:48 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 18 2021 - 20:00:33 CEST