xkb: Avoid length-check failure on empty strings.
_XkbCheckRequestBounds assumes that from..to is at least one byte. However, request strings can be empty, causing spurious failures in XkbGetKbdByName calls. To avoid this, before checking bounds make sure that the length is nonzero.
This commit is contained in:
parent
d23e446558
commit
79c572fbd3
|
@ -5817,11 +5817,11 @@ GetComponentSpec(ClientPtr client, xkbGetKbdByNameReq *stuff,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
len = (*(unsigned char *) wire++);
|
len = (*(unsigned char *) wire++);
|
||||||
|
if (len > 0) {
|
||||||
if (!_XkbCheckRequestBounds(client, stuff, wire, wire + len)) {
|
if (!_XkbCheckRequestBounds(client, stuff, wire, wire + len)) {
|
||||||
*errRtrn = BadLength;
|
*errRtrn = BadLength;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (len > 0) {
|
|
||||||
str = calloc(1, len + 1);
|
str = calloc(1, len + 1);
|
||||||
if (str) {
|
if (str) {
|
||||||
tmp = str;
|
tmp = str;
|
||||||
|
|
Loading…
Reference in New Issue