aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-07-01 15:00:06 -0500
committerRob Landley <rob@landley.net>2015-07-01 15:00:06 -0500
commit8a2c0876754baa2085bce94d6778b5d2f4aee937 (patch)
tree5efcacf54d2508aa341759844d7940269ce1ed44 /lib
parent8c0d2d2bc557ced86650ab48ab92cf58840efce8 (diff)
downloadtoybox-8a2c0876754baa2085bce94d6778b5d2f4aee937.tar.gz
Fix segfault with "mount -o ro,remount".
Or any call to comma_scan where 'opt' appears as the last item in 'optlist'.
Diffstat (limited to 'lib')
-rw-r--r--lib/getmountlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/getmountlist.c b/lib/getmountlist.c
index 30fb9a35..4fec41b7 100644
--- a/lib/getmountlist.c
+++ b/lib/getmountlist.c
@@ -78,7 +78,7 @@ int comma_scan(char *optlist, char *opt, int clean)
no = 2*(*s == 'n' && s[1] == 'o');
if (optlen == len-no && !strncmp(opt, s+no, optlen)) {
got = !no;
- if (clean) memmove(s, optlist, strlen(optlist)+1);
+ if (clean && optlist) memmove(s, optlist, strlen(optlist)+1);
}
}