aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2016-02-04 10:49:52 -0800
committerRob Landley <rob@landley.net>2016-02-05 12:30:16 -0600
commit2fd8d1a2595ee49f01d2987b125b642b7f50ea65 (patch)
tree4b7cdf41232624bbf6dcfce305e53e0d773e05c5 /toys/posix
parentc02619bbc0acbb2b4588933ec1bbb7b7026adbb6 (diff)
downloadtoybox-2fd8d1a2595ee49f01d2987b125b642b7f50ea65.tar.gz
Fix segfault when `find -iname` gets no argument.
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/find.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c
index febe688b..65beeb54 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -321,7 +321,8 @@ static int do_find(struct dirtree *new)
if (new && s[i] == 'p') name = path = dirtree_path(new, 0);
if (i) {
if (check || !new) {
- name = strlower(new ? name : arg);
+ char *temp = new ? name : arg;
+ name = temp ? strlower(temp) : 0;
if (!new) {
dlist_add(&TT.argdata, name);
free(path);