dbpware-for-solaris/tar/src/tar-1.13.25-argv.patch
Tom G. Christensen 87fd44a463 Latest GNU tar
This is the version used in most Linux dists
2004-01-29 14:13:13 +00:00

23 lines
696 B
Diff

--- tar-1.13.25/src/tar.c 2001-09-21 02:11:27.000000000 +0200
+++ tar-1.13.25/src/tar.c 2002-06-16 18:19:04.000000000 +0200
@@ -534,7 +534,7 @@
/* Allocate a new argument array, and copy program name in it. */
new_argc = argc - 1 + strlen (argv[1]);
- new_argv = xmalloc (new_argc * sizeof (char *));
+ new_argv = xmalloc ((new_argc + 1) * sizeof (char *));
in = argv;
out = new_argv;
*out++ = *in++;
@@ -562,6 +562,10 @@
while (in < argv + argc)
*out++ = *in++;
+ /* K&R standard requires a NULL termination */
+
+ *out = NULL;
+
/* Replace the old option list by the new one. */
argc = new_argc;