summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2007-09-23 17:50:41 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2007-09-23 17:50:41 +0200
commite8ffa513a109209849b11a3c608356cc28314a8e (patch)
treeac839784af6e8d8e86777ec4f30b338aa5f96384
parentdfa65b0c8df6a6aab4f86c32a0acb41f44201e7c (diff)
Fixed an invalid memory access.
Some keynames are less than 3 characters long (not counting the terminator). We're now also initializing all of the keyName array.
-rw-r--r--xkbparse.y3
1 files changed, 2 insertions, 1 deletions
diff --git a/xkbparse.y b/xkbparse.y
index 662325b..f3eb7fe 100644
--- a/xkbparse.y
+++ b/xkbparse.y
@@ -705,7 +705,8 @@ Terminal : String
{
ExprDef *expr;
expr= ExprCreate(ExprValue,TypeKeyName);
- memcpy(expr->value.keyName,$1,4);
+ memset(expr->value.keyName,0,5);
+ strncpy(expr->value.keyName,$1,4);
free($1);
$$= expr;
}