mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
more range checking
This commit is contained in:
parent
c7e2ee5dd5
commit
6f10349843
11
parse.y
11
parse.y
@ -116,21 +116,21 @@ main : FONTNAME STRING {
|
|||||||
conf->flags |= CONF_STICKY_GROUPS;
|
conf->flags |= CONF_STICKY_GROUPS;
|
||||||
}
|
}
|
||||||
| BORDERWIDTH NUMBER {
|
| BORDERWIDTH NUMBER {
|
||||||
if ($2 < 0) {
|
if ($2 < 0 || $2 > UINT_MAX) {
|
||||||
yyerror("invalid borderwidth: %d", $2);
|
yyerror("invalid borderwidth: %d", $2);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
conf->bwidth = $2;
|
conf->bwidth = $2;
|
||||||
}
|
}
|
||||||
| MOVEAMOUNT NUMBER {
|
| MOVEAMOUNT NUMBER {
|
||||||
if ($2 < 0) {
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
yyerror("invalid movemount: %d", $2);
|
yyerror("invalid movemount: %d", $2);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
conf->mamount = $2;
|
conf->mamount = $2;
|
||||||
}
|
}
|
||||||
| SNAPDIST NUMBER {
|
| SNAPDIST NUMBER {
|
||||||
if ($2 < 0) {
|
if ($2 < 0 || $2 > INT_MAX) {
|
||||||
yyerror("invalid snapdist: %d", $2);
|
yyerror("invalid snapdist: %d", $2);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
}
|
}
|
||||||
@ -165,7 +165,10 @@ main : FONTNAME STRING {
|
|||||||
free($3);
|
free($3);
|
||||||
}
|
}
|
||||||
| GAP NUMBER NUMBER NUMBER NUMBER {
|
| GAP NUMBER NUMBER NUMBER NUMBER {
|
||||||
if ($2 < 0 || $3 < 0 || $4 < 0 || $5 < 0) {
|
if ($2 < 0 || $2 > INT_MAX ||
|
||||||
|
$3 < 0 || $3 > INT_MAX ||
|
||||||
|
$4 < 0 || $4 > INT_MAX ||
|
||||||
|
$5 < 0 || $5 > INT_MAX) {
|
||||||
yyerror("invalid gap: %d %d %d %d",
|
yyerror("invalid gap: %d %d %d %d",
|
||||||
$2, $3, $4, $5);
|
$2, $3, $4, $5);
|
||||||
YYERROR;
|
YYERROR;
|
||||||
|
Loading…
Reference in New Issue
Block a user