summaryrefslogtreecommitdiff
path: root/xkbscan.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-03Only build debug infrastructure if DEBUG is definedAlan Coopersmith1-0/+2
It's only used when DEBUG is defined, so don't build it when we're not using it. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Variable scope reductionsAlan Coopersmith1-2/+2
Some found by cppcheck, some found by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2021-01-21Remove trailing whitespacesPeter Hutterer1-9/+9
Let's clean this up so I don't have to fight vim and git in removing them. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-29Making sure that a copied string is always null-terminated (#66345).Benno Schulenberg1-12/+2
A more minimalistic and formally correct solution. This amends and extends the previous fix for bug #66345, fixing not just yyGetKeyName() but also yyGetString(). Signed-off-by: Benno Schulenberg <bensberg@justemail.net> Fixes a typo from cdcd552 (should be sizeof - 1, not sizeof -i). Code flows that i is at most sizeof(scanBuf) - 1, so last is not needed. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-18Always terminate the scanBuf string (#66345)Peter Hutterer1-1/+10
If a key name exceeds 4 characters, the content of scanBuf is not null-terminated, giving error messages like syntax error: line 7 of test.xkb last scanned symbol is: FOOBARm Errors encountered in test.xkb; not compiled. (last character of the preceding 'maximum' statement in this case) X.Org Bug 66345 <http://bugs.freedesktop.org/show_bug.cgi?id=66345> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-07-13Add #include <stdlib.h> to xkbscan.cLaura1-0/+1
This fixes an issue with _exit not declared when building xkbcomp version 1.2.4 natively on Windows using MinGW32 (version 4.7.2) from www.mingw.org. https://bugs.freedesktop.org/show_bug.cgi?id=62365 Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-11-01Reset scan state when opening a new fileDaniel Stone1-1/+9
When we opened a new file after encountering a parse error, we weren't resetting our scan state, and continued to read out of the old buffer rather than that of the new file. Fixes a regression introduced in 9887842e ('Use fread() instead of getc()'). Test case: xkbcomp -lfhlpR "path/to/xkeyboard-config.git/symbols/*" The Makefiles in that tree would cause parse errors, the resulting directory file is incomplete (down from ~12000 to ~230 lines). Reported-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-12-28Make sure to leave room for trailing nil byte in yyGetNumberAlan Coopersmith1-3/+3
...though really, by the time you've added 1023 digits to the number you want to parse, you've got much bigger problems than an off-by-one error in your buffer count. Fixes parfait warnings: Buffer overflow (CWE 120): In array dereference of (*buf)[nInBuf] with index 'nInBuf' Array size is 1024 bytes, nInBuf >= 1 and nInBuf <= 1024 at line 625 of xkbscan.c in function 'yyGetNumber'. Buffer overflow (CWE 120): In array dereference of (*buf)[nInBuf] with index 'nInBuf' Array size is 1024 bytes, nInBuf <= 1025 at line 632 of xkbscan.c in function 'yyGetNumber'. [ This bug was found by the Parfait 0.4.2 bug checking tool. For more information see http://labs.oracle.com/projects/parfait/ ] Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-04-04xkbcomp: Stop possible overflow in yyGetnumber. #31647Alistair Leslie-Hughes1-3/+6
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31647 Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2010-07-12Fix signedness issue with getc() return valueJulien Cristau1-2/+2
getc() and ungetc() return and take, respectively, an int rather than a char to allow for error values as well. Oops. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-15Don't malloc() and free() most scanned symbolsDaniel Stone1-28/+16
Use a constant buffer. Sigh. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-15Fix compilation with DEBUGDaniel Stone1-0/+2
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-15Use fread() instead of getc()Daniel Stone1-44/+76
So, it turns out that if you're parsing a fairly large amount of data, using getc() to get all the input rather than, say, read(), is some kind of remarkably daft and unperformant idea. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-21Correct make distcheck and most gcc and sparse warnings.Paulo Cesar Pereira de Andrade1-8/+5
Remaining warnings are due to macros that check address or vectors on the stack and auto generated yacc code. Compiled with default flags and also as: % make CFLAGS=-DENTRY_TRACKING_ON -DDEBUG_ON -DASSERTIONS_ON to ensure the "simplification" of code like: foo.c: <hash>define DEBUG_VAR foo_VAR <hash>include "foo.h" ... foo.h: <hash>ifdef DEBUG_VAR_NOT_LOCAL extern <hash>endif int DEBUG_VAR; ... did not change the author's "intended" logic.
2008-09-05sprintf -> snprintf conversionsAlan Coopersmith1-64/+64
2008-08-18Silence valgrind warnings.Peter Hutterer1-1/+1
"Conditional jump or move depends on uninitialised value(s)"
2008-08-12Indent fixes.Peter Hutterer1-353/+613
indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
2008-08-12Remove RCS tags.Peter Hutterer1-2/+0
2007-09-23Fixed a bunch of const correctness bugs.Tilman Sauerbeck1-1/+1
2004-04-23Merging XORG-CURRENT into trunkXORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGEEgbert Eich1-1/+1
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich1-1/+1
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich1-1/+1
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich1-1/+1
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich1-1/+1
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_901xf86-4_3_99_16Kaleb Keithley1-15/+18
2003-11-14XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley1-39/+8
2003-11-14R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley1-0/+496