Commit 77614b61b1 for openssl.org
commit 77614b61b18c9581effa44b9c0451aab6c16ec5a
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date: Tue May 19 08:32:06 2026 +0200
crypto/objects/obj_dat.c: return strlcpy result in OBJ_obj2txt()
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)
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index 8ab0634916..570fde8d15 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -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);
}
}