summaryrefslogtreecommitdiff
path: root/find
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2020-10-16 16:25:13 +0200
committerBernhard Voelker <mail@bernhard-voelker.de>2020-10-19 19:02:07 +0200
commitb818a7086b921ea66d2e31dd11add1c34bb5dddf (patch)
treecd2b30f3ea5f1dcfa218b9b26289eb26a5f3d954 /find
parentefa455493063270406f3c206d62032a475e52c47 (diff)
downloadfindutils-b818a7086b921ea66d2e31dd11add1c34bb5dddf.tar.gz
find: add error handling for strdup in the '-print %h' case
* find/print.c (do_fprintf): Change strdup call to xstrdup to ensure proper error handling. Reported by Infer. Fixes https://sv.gnu.org/bugs/?59133
Diffstat (limited to 'find')
-rw-r--r--find/print.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/find/print.c b/find/print.c
index 8b555343..88635b54 100644
--- a/find/print.c
+++ b/find/print.c
@@ -958,7 +958,7 @@ do_fprintf (struct format_val *dest,
case 'h': /* leading directories part of path */
/* sanitised */
{
- char *pname = strdup (pathname);
+ char *pname = xstrdup (pathname);
/* Remove trailing slashes - unless it's the root '/' directory. */
char *s = pname + strlen (pname) -1;