diff options
author | okan | 2013-05-06 19:09:19 +0000 |
---|---|---|
committer | okan | 2013-05-06 19:09:19 +0000 |
commit | c8bce629dc68f1e1315cceadd4a6d8d45cbadec1 (patch) | |
tree | d2f92cb964895d0790fa9cfdb23810d2e3267145 | |
parent | 99735d22776eb0d958a17a9b07471da6dafabd42 (diff) | |
download | cwm-c8bce629dc68f1e1315cceadd4a6d8d45cbadec1.tar.gz |
negative values for borderwith, moveamount, snapdist and gap are
configuration errors, so warn and load defaults.
-rw-r--r-- | parse.y | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.40 2013/04/17 13:30:38 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.41 2013/05/06 19:09:19 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -117,12 +117,24 @@ main : FONTNAME STRING { conf->flags |= CONF_STICKY_GROUPS; } | BORDERWIDTH NUMBER { + if ($2 < 0) { + yyerror("invalid borderwidth: %d", $2); + YYERROR; + } conf->bwidth = $2; } | MOVEAMOUNT NUMBER { + if ($2 < 0) { + yyerror("invalid movemount: %d", $2); + YYERROR; + } conf->mamount = $2; } | SNAPDIST NUMBER { + if ($2 < 0) { + yyerror("invalid snapdist: %d", $2); + YYERROR; + } conf->snapdist = $2; } | COMMAND STRING string { @@ -133,10 +145,9 @@ main : FONTNAME STRING { | AUTOGROUP NUMBER STRING { if ($2 < 0 || $2 > 9) { free($3); - yyerror("autogroup number out of range: %d", $2); + yyerror("invalid autogroup: %d", $2); YYERROR; } - conf_autogroup(conf, $2, $3); free($3); } @@ -150,6 +161,11 @@ main : FONTNAME STRING { free($3); } | GAP NUMBER NUMBER NUMBER NUMBER { + if ($2 < 0 || $3 < 0 || $4 < 0 || $5 < 0) { + yyerror("invalid gap: %d %d %d %d", + $2, $3, $4, $5); + YYERROR; + } conf->gap.top = $2; conf->gap.bottom = $3; conf->gap.left = $4; |