tdb_unpack: Convert to size_t for internal calculations
authorVolker Lendecke <vl@samba.org>
Thu, 4 Oct 2018 08:57:47 +0000 (10:57 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 8 Oct 2018 20:17:09 +0000 (22:17 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_tdb.c

index 80e66e0a108fbabb8754d34debf90ad0bfb37485..9f39fcb4df334d11e152d96d28e448375fd4e5ea 100644 (file)
@@ -145,20 +145,20 @@ size_t tdb_pack(uint8_t *buf, int bufsize, const char *fmt, ...)
  integers and strings.
 ****************************************************************************/
 
-int tdb_unpack(const uint8_t *buf, int bufsize, const char *fmt, ...)
+int tdb_unpack(const uint8_t *buf, int in_bufsize, const char *fmt, ...)
 {
        va_list ap;
        uint8_t *bt;
        uint16_t *w;
        uint32_t *d;
-       int len;
+       size_t bufsize = in_bufsize;
+       size_t len;
        int *i;
        void **p;
        char *s, **b, **ps;
        char c;
        const uint8_t *buf0 = buf;
        const char *fmt0 = fmt;
-       int bufsize0 = bufsize;
 
        va_start(ap, fmt);
 
@@ -249,7 +249,7 @@ int tdb_unpack(const uint8_t *buf, int bufsize, const char *fmt, ...)
        va_end(ap);
 
        DEBUG(18,("tdb_unpack(%s, %d) -> %d\n",
-                fmt0, bufsize0, (int)PTR_DIFF(buf, buf0)));
+                fmt0, in_bufsize, (int)PTR_DIFF(buf, buf0)));
 
        return PTR_DIFF(buf, buf0);