]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ntlm: Check buffer length on responses
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 18 May 2020 09:33:39 +0000 (12:33 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 25 May 2020 11:28:09 +0000 (14:28 +0300)
Add missing check for buffer length.

If this is not checked, it is possible to send message which
causes read past buffer bug.

Broken in c7480644202e5451fbed448508ea29a25cffc99c

src/lib-ntlm/ntlm-message.c

index 160b9f918c959914a9c2ff91b4f024c76fbf700c..a29413b47e801343a0e847f254100b91e5375a77 100644 (file)
@@ -184,6 +184,11 @@ static bool ntlmssp_check_buffer(const struct ntlmssp_buffer *buffer,
        if (length == 0 && space == 0)
                return TRUE;
 
+       if (length > data_size) {
+               *error = "buffer length out of bounds";
+               return FALSE;
+       }
+
        if (offset >= data_size) {
                *error = "buffer offset out of bounds";
                return FALSE;