aboutsummaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authorokan2014-01-29 18:34:22 +0000
committerokan2014-01-29 18:34:22 +0000
commit08fa24dca333c81539bb60aedcaa48ce1bee7beb (patch)
treecb65a6853aed7befbde97e10baa51336719f0b46 /parse.y
parent673041f76297706b7679f3140891e8ab1dd548d8 (diff)
downloadcwm-08fa24dca333c81539bb60aedcaa48ce1bee7beb.tar.gz
Check command name/path for truncation and provide user feedback during
config parse (and use conf_cmd_add to populate defaults); based on a discussion with Tiago Cunha. While this looks ugly, there are likely some other changes here to come.
Diffstat (limited to '')
-rw-r--r--parse.y9
1 files changed, 7 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index f218a13..f42fd56 100644
--- a/parse.y
+++ b/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.55 2014/01/28 20:22:21 okan Exp $ */
+/* $OpenBSD: parse.y,v 1.56 2014/01/29 18:34:22 okan Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -137,7 +137,12 @@ main : FONTNAME STRING {
conf->snapdist = $2;
}
| COMMAND STRING string {
- conf_cmd_add(conf, $2, $3);
+ if (!conf_cmd_add(conf, $2, $3)) {
+ yyerror("command name/path too long");
+ free($2);
+ free($3);
+ YYERROR;
+ }
free($2);
free($3);
}