diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2020-10-16 16:25:13 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2020-10-19 19:02:07 +0200 |
commit | b818a7086b921ea66d2e31dd11add1c34bb5dddf (patch) | |
tree | cd2b30f3ea5f1dcfa218b9b26289eb26a5f3d954 /find | |
parent | efa455493063270406f3c206d62032a475e52c47 (diff) | |
download | findutils-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.c | 2 |
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; |