]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
This is why consistency is important...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 Jun 2020 20:45:24 +0000 (15:45 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 4 Jun 2020 20:45:24 +0000 (15:45 -0500)
src/lib/util/talloc.c

index 87b9edb1fb5fe1e995931f9f0be172b8b1346adc..18efa59cf7405bebc95ddb5c3c7e6ca8041350cb 100644 (file)
@@ -364,11 +364,11 @@ char *talloc_typed_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap)
 char *talloc_bstrdup(TALLOC_CTX *ctx, char const *in)
 {
        char    *p;
-       size_t  len = talloc_array_length(in);
+       size_t  inlen = talloc_array_length(in);
 
-       if (len == 0) len = 1;
+       if (inlen == 0) inlen = 1;
 
-       p = talloc_array(ctx, char, len);
+       p = talloc_array(ctx, char, inlen);
        if (!p) return NULL;
 
        /*
@@ -376,8 +376,8 @@ char *talloc_bstrdup(TALLOC_CTX *ctx, char const *in)
         *
         * But ubsan still flags this, grrr.
         */
-       if (inlen > 0) memcpy(p, in, len - 1);
-       p[len] = '\0';
+       if (inlen > 0) memcpy(p, in, inlen - 1);
+       p[inlen] = '\0';
 
        return p;
 }