tdb_unpack: Correct "len" arg for "B" format
authorVolker Lendecke <vl@samba.org>
Thu, 4 Oct 2018 09:05:46 +0000 (11:05 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 8 Oct 2018 20:17:09 +0000 (22:17 +0200)
All but one of the users of the "B" format specifier passed in a pointer
to uint32_t instead of what tdb_unpack expected, an "int". Because this
is a purely internal API, change the tdb_unpack function and adjust that
one caller.

To reviewers: Please check carefully, thanks :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_tdb.c
source3/printing/printing.c

index 9f39fcb4df334d11e152d96d28e448375fd4e5ea..035daf8b7b77064a52951a94c2c3b0fcfe61b651 100644 (file)
@@ -153,7 +153,7 @@ int tdb_unpack(const uint8_t *buf, int in_bufsize, const char *fmt, ...)
        uint32_t *d;
        size_t bufsize = in_bufsize;
        size_t len;
-       int *i;
+       uint32_t *i;
        void **p;
        char *s, **b, **ps;
        char c;
@@ -216,7 +216,7 @@ int tdb_unpack(const uint8_t *buf, int in_bufsize, const char *fmt, ...)
                        memcpy(s, buf, len);
                        break;
                case 'B': /* fixed-length string */
-                       i = va_arg(ap, int *);
+                       i = va_arg(ap, uint32_t *);
                        b = va_arg(ap, char **);
                        len = 4;
                        if (bufsize < len)
index 105166ddf7dd86a7c3e6d574dced4fdd6b6c3f4d..e6caaa1222f7163d7f069cbc349416085d1c2976 100644 (file)
@@ -352,7 +352,7 @@ static int unpack_devicemode(TALLOC_CTX *mem_ctx,
        struct spoolss_DeviceMode *dm;
        enum ndr_err_code ndr_err;
        char *data = NULL;
-       int data_len = 0;
+       uint32_t data_len = 0;
        DATA_BLOB blob;
        int len = 0;