mirror of
https://github.com/samba-team/samba.git
synced 2025-03-20 22:50:26 +03:00
CVE-2023-34966: mdssvc: harden sl_unpack_loop()
A malicious client could send a packet where subcount is zero, leading to a busy loop because count -= subcount => count -= 0 => while (count > 0) loops forever. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15340 Signed-off-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
6e5e5c7f64
commit
c77b31f1bc
@ -1119,7 +1119,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
|
||||
sl_nil_t nil = 0;
|
||||
|
||||
subcount = tag.count;
|
||||
if (subcount > count) {
|
||||
if (subcount < 1 || subcount > count) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < subcount; i++) {
|
||||
@ -1147,7 +1147,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
|
||||
|
||||
case SQ_TYPE_INT64:
|
||||
subcount = sl_unpack_ints(query, buf, offset, bufsize, encoding);
|
||||
if (subcount == -1 || subcount > count) {
|
||||
if (subcount < 1 || subcount > count) {
|
||||
return -1;
|
||||
}
|
||||
offset += tag.size;
|
||||
@ -1156,7 +1156,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
|
||||
|
||||
case SQ_TYPE_UUID:
|
||||
subcount = sl_unpack_uuid(query, buf, offset, bufsize, encoding);
|
||||
if (subcount == -1 || subcount > count) {
|
||||
if (subcount < 1 || subcount > count) {
|
||||
return -1;
|
||||
}
|
||||
offset += tag.size;
|
||||
@ -1165,7 +1165,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
|
||||
|
||||
case SQ_TYPE_FLOAT:
|
||||
subcount = sl_unpack_floats(query, buf, offset, bufsize, encoding);
|
||||
if (subcount == -1 || subcount > count) {
|
||||
if (subcount < 1 || subcount > count) {
|
||||
return -1;
|
||||
}
|
||||
offset += tag.size;
|
||||
@ -1174,7 +1174,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
|
||||
|
||||
case SQ_TYPE_DATE:
|
||||
subcount = sl_unpack_date(query, buf, offset, bufsize, encoding);
|
||||
if (subcount == -1 || subcount > count) {
|
||||
if (subcount < 1 || subcount > count) {
|
||||
return -1;
|
||||
}
|
||||
offset += tag.size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user