summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-08-05 13:25:22 +0100
committerFrediano Ziglio <fziglio@redhat.com>2015-08-05 13:25:22 +0100
commit856daf2443ee60f6b56e469e3a7f6600e599aaee (patch)
tree4543fe3d2040a8de84bcb7175ec07f268844dd48
parent85f2066c9b502ac647e324de289b185078d7be25 (diff)
Fix buffer overflow in xev.c
If initially buffer is smaller size returned is too big, do not use to terminate the string. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--xev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xev.c b/xev.c
index 3146d81..6f6b5bb 100644
--- a/xev.c
+++ b/xev.c
@@ -101,13 +101,13 @@ do_KeyPress (XEvent *eventp)
if (e->type == KeyPress && xic) {
do {
nmbbytes = XmbLookupString (xic, e, buf, bsize - 1, &ks, &status);
- buf[nmbbytes] = '\0';
if (status == XBufferOverflow) {
bsize = nmbbytes + 1;
buf = realloc (buf, bsize);
}
} while (status == XBufferOverflow);
+ buf[nmbbytes] = '\0';
}
if (ks == NoSymbol)