Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144623316
D41040.1775843585.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
751 B
Referenced Files
None
Subscribers
None
D41040.1775843585.diff
View Options
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c
--- a/usr.bin/xargs/xargs.c
+++ b/usr.bin/xargs/xargs.c
@@ -258,8 +258,8 @@
* NULL.
*/
linelen = 1 + argc + (size_t)nargs + 1;
- if ((av = bxp = malloc(linelen * sizeof(char *))) == NULL)
- errx(1, "malloc failed");
+ if ((av = bxp = calloc(linelen, sizeof(char *))) == NULL)
+ errx(1, "calloc failed");
/*
* Use the user's name for the utility as argv[0], just like the
@@ -499,9 +499,9 @@
* Allocate memory to hold the argument list, and
* a NULL at the tail.
*/
- tmp = malloc((argc + 1) * sizeof(char *));
+ tmp = calloc(argc + 1, sizeof(char *));
if (tmp == NULL) {
- warnx("malloc failed");
+ warnx("calloc failed");
xexit(*argv, 1);
}
tmp2 = tmp;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 10, 5:53 PM (9 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28318081
Default Alt Text
D41040.1775843585.diff (751 B)
Attached To
Mode
D41040: xargs: Avoid a possible multiplication overflow
Attached
Detach File
Event Timeline
Log In to Comment