summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-11-12 12:40:04 -0800
committerMarge Bot <emma+marge@anholt.net>2024-11-16 21:11:07 +0000
commit5a7d94e07fc7e4a10d6399f5e44793fa0c896af6 (patch)
treeb44d29e8966f514132c07c68a93d9f11defa8b8f
parent1ef3c6f010c03eade038b4e662c0eef47014800d (diff)
xkb: avoid undefined behavior due to left shift overflowHEADmaster
Closes: #225 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/273>
-rw-r--r--src/xkb/XKBleds.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/xkb/XKBleds.c b/src/xkb/XKBleds.c
index 5c51f276..8e75ea54 100644
--- a/src/xkb/XKBleds.c
+++ b/src/xkb/XKBleds.c
@@ -72,16 +72,14 @@ _XkbReadGetIndicatorMapReply(Display *dpy,
leds->phys_indicators = rep->realIndicators;
if (rep->length > 0) {
- register int left;
-
if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4))
return BadAlloc;
if (nread_rtrn)
*nread_rtrn = (int) rep->length * 4;
if (rep->which) {
- register int i, bit;
+ unsigned int i, bit, left;
- left = (int) rep->which;
+ left = rep->which;
for (i = 0, bit = 1; (i < XkbNumIndicators) && (left);
i++, bit <<= 1) {
if (left & bit) {
@@ -106,7 +104,7 @@ _XkbReadGetIndicatorMapReply(Display *dpy,
}
}
}
- left = _XkbFreeReadBuffer(&buf);
+ (void) _XkbFreeReadBuffer(&buf);
}
return Success;
}