]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/objects/obj_dat.c: return strlcpy result in OBJ_obj2txt()
authorEugene Syromiatnikov <esyr@openssl.org>
Tue, 19 May 2026 06:32:06 +0000 (08:32 +0200)
committerEugene Syromiatnikov <esyr@openssl.org>
Tue, 26 May 2026 08:57:56 +0000 (10:57 +0200)
strlcpy() (and OPENSSL_strlcpy() after it) returns the length
of the input string as a result, don't throw it away just to calculate
it once again on return.

Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
MergeDate: Tue May 26 08:58:27 2026
(Merged from https://github.com/openssl/openssl/pull/31226)

crypto/objects/obj_dat.c

index 8ab06349163c66570fac5ba839e4c5d1cf68aeee..570fde8d1564105f01b38013bd97cd3d672a7772 100644 (file)
@@ -399,7 +399,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
             s = OBJ_nid2sn(nid);
         if (s != NULL) {
             if (buf != NULL)
-                OPENSSL_strlcpy(buf, s, buf_len);
+                return (int)OPENSSL_strlcpy(buf, s, buf_len);
             return (int)strlen(s);
         }
     }