]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/security: Emit error message if program is too large
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 2 Aug 2023 02:15:09 +0000 (14:15 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 27 Sep 2023 02:43:28 +0000 (02:43 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/security/conditional_ace.c

index b970e2fe0b4f13995ed5610e4bdc7820f015924d..50935a20a5392deb9a2fd35ffe4178c91a3a24ec 100644 (file)
@@ -2055,6 +2055,7 @@ bool conditional_ace_encode_binary(TALLOC_CTX *mem_ctx,
                data[j] = tok->type;
                j++;
                if (j >= alloc_size) {
+                       DBG_ERR("program exceeds %zu bytes\n", alloc_size);
                        goto error;
                }
 
@@ -2132,16 +2133,19 @@ bool conditional_ace_encode_binary(TALLOC_CTX *mem_ctx,
                        goto error;
                }
                if (consumed == -1) {
+                       DBG_ERR("program exceeds %zu bytes\n", alloc_size);
                        goto error;
                }
                j += consumed;
                if (j >= alloc_size) {
+                       DBG_ERR("program exceeds %zu bytes\n", alloc_size);
                        goto error;
                }
        }
        /* align to a 4 byte boundary */
        required_size = (j + 3) & ~((size_t)3);
        if (required_size > alloc_size) {
+               DBG_ERR("program exceeds %zu bytes\n", alloc_size);
                goto error;
        }
        while (j < required_size) {