]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10410 lutil_strncopy: fix off by one
authorHoward Chu <hyc@openldap.org>
Mon, 1 Dec 2025 15:18:54 +0000 (15:18 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 1 Dec 2025 15:18:54 +0000 (15:18 +0000)
libraries/liblutil/utils.c

index df9a8b0bc7c0ed42f394b0725f5a9e59779d9916..6b2ba549d3ad7e0402e5d7e815f7d7b9c1fc6192 100644 (file)
@@ -399,7 +399,7 @@ lutil_strncopy(
        if (!a || !b || n == 0)
                return a;
        
-       while ((*a++ = *b++) && n-- > 0) ;
+       while ((*a++ = *b++) && --n > 0) ;
        return a-1;
 }