summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2017-01-10 08:25:03 +0000
committermav <mav@FreeBSD.org>2017-01-10 08:25:03 +0000
commitbfae1665feaa2c4ad5ae7befe82bf09eead4eb69 (patch)
tree83eba95aa7b09b9fe04c4cdbcc6fcc4a2cf91f39 /usr.sbin
parent01bace6361f834a727e24dcc7434e8f91ac69f5b (diff)
downloadFreeBSD-src-bfae1665feaa2c4ad5ae7befe82bf09eead4eb69.zip
FreeBSD-src-bfae1665feaa2c4ad5ae7befe82bf09eead4eb69.tar.gz
MFC r310633: Add MAX_LUNS overflow safety checks.
While this MAX_LUNS limitation is too synthetic and should be removed, it is better to enforce it while it is here.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ctld/parse.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.sbin/ctld/parse.y b/usr.sbin/ctld/parse.y
index 1de1e88..da5d52c 100644
--- a/usr.sbin/ctld/parse.y
+++ b/usr.sbin/ctld/parse.y
@@ -808,6 +808,11 @@ lun_number: STR
free($1);
return (1);
}
+ if (tmp >= MAX_LUNS) {
+ yyerror("LU number is too big");
+ free($1);
+ return (1);
+ }
ret = asprintf(&name, "%s,lun,%ju", target->t_name, tmp);
if (ret <= 0)
@@ -832,6 +837,11 @@ target_lun_ref: LUN STR STR
return (1);
}
free($2);
+ if (tmp >= MAX_LUNS) {
+ yyerror("LU number is too big");
+ free($3);
+ return (1);
+ }
lun = lun_find(conf, $3);
free($3);
OpenPOWER on IntegriCloud