summaryrefslogtreecommitdiff
path: root/app/xkbcomp/xkbscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/xkbcomp/xkbscan.c')
-rw-r--r--app/xkbcomp/xkbscan.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/xkbcomp/xkbscan.c b/app/xkbcomp/xkbscan.c
index b355e06bb..0bc9ccef9 100644
--- a/app/xkbcomp/xkbscan.c
+++ b/app/xkbcomp/xkbscan.c
@@ -606,14 +606,16 @@ yyGetIdent(int first)
static int
yyGetNumber(int ch)
{
+ const int nMaxBuffSize = 1024;
int isFloat = 0;
- char buf[1024];
+ char buf[nMaxBuffSize];
int nInBuf = 0;
buf[0] = ch;
nInBuf = 1;
while (((ch = scanchar()) != EOF)
- && (isxdigit(ch) || ((nInBuf == 1) && (ch == 'x'))))
+ && (isxdigit(ch) || ((nInBuf == 1) && (ch == 'x')))
+ && nInBuf < nMaxBuffSize)
{
buf[nInBuf++] = ch;
}
@@ -621,7 +623,8 @@ yyGetNumber(int ch)
{
isFloat = 1;
buf[nInBuf++] = ch;
- while (((ch = scanchar()) != EOF) && (isxdigit(ch)))
+ while (((ch = scanchar()) != EOF) && (isxdigit(ch))
+ && nInBuf < nMaxBuffSize)
{
buf[nInBuf++] = ch;
}