summaryrefslogtreecommitdiff
path: root/sys/src/9/port/devsd.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-02-25 17:11:18 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2018-02-25 17:11:18 +0100
commitb2d79920255fc405b972e4c900e47f4a1046e044 (patch)
treeb0ee1c462368b365880b6adb2fb8ea6b64b5336f /sys/src/9/port/devsd.c
parentd3f4786a1fcfb3cf8eba0cad2457622c6487e0e9 (diff)
kernel: properly handle bad attach specifiers
- only accept decimal for numeric device id's - exclude negative device id's - device id's out of range yield Enodev
Diffstat (limited to 'sys/src/9/port/devsd.c')
-rw-r--r--sys/src/9/port/devsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/src/9/port/devsd.c b/sys/src/9/port/devsd.c
index 5ea1d47b8..32d6f26a1 100644
--- a/sys/src/9/port/devsd.c
+++ b/sys/src/9/port/devsd.c
@@ -662,8 +662,8 @@ sdattach(char* spec)
if(spec[0] != 's' || spec[1] != 'd')
error(Ebadspec);
idno = spec[2];
- subno = strtol(&spec[3], &p, 0);
- if(p == &spec[3])
+ subno = strtol(&spec[3], &p, 10);
+ if(subno < 0 || p == &spec[3])
error(Ebadspec);
if((sdev=sdgetdev(idno)) == nil)