diff options
author | Rob Landley <rob@landley.net> | 2016-02-05 12:37:50 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-02-05 12:37:50 -0600 |
commit | 0f11b42938f4ae32b2c80b1c0644b75e64da4ada (patch) | |
tree | 21e87a8800320b228ffb4d99dc953ec33455c06e /toys | |
parent | 2fd8d1a2595ee49f01d2987b125b642b7f50ea65 (diff) | |
download | toybox-0f11b42938f4ae32b2c80b1c0644b75e64da4ada.tar.gz |
Another fix from Josh Gao to avoid a null pointer dereference, and
minor cleanup of previous commit.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/find.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/posix/find.c b/toys/posix/find.c index 65beeb54..a9c35f41 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -315,14 +315,13 @@ static int do_find(struct dirtree *new) || !strcmp(s, "path") || !strcmp(s, "ipath")) { int i = (*s == 'i'); - char *arg = ss[1], *path = 0, *name = new->name; + char *arg = ss[1], *path = 0, *name = new ? new->name : arg; // Handle path expansion and case flattening if (new && s[i] == 'p') name = path = dirtree_path(new, 0); if (i) { if (check || !new) { - char *temp = new ? name : arg; - name = temp ? strlower(temp) : 0; + if (name) name = strlower(name); if (!new) { dlist_add(&TT.argdata, name); free(path); |