Subject: | X509_NAME_get_text_by_NID returns string including trailing \0 |
The C function X509_NAME_get_text_by_NID returns the string including
the trailing \0. This string is then put into an SV, including the
trailing \0. This is wrong, it should be added without the \0.
Fix is simple and works for me:
- sv_setpvn( ST(0), buf, length + 1);
+ sv_setpvn( ST(0), buf, length);
Included as a patch agains 1.33_01, SVN 223.
Regards,
Steffen
Subject: | SSLeay.xs.patch |
Index: trunk/SSLeay.xs
===================================================================
--- trunk/SSLeay.xs (revision 223)
+++ trunk/SSLeay.xs (working copy)
@@ -1505,7 +1505,7 @@
New(0, buf, length+1, char);
if (X509_NAME_get_text_by_NID(name, nid, buf, length + 1))
- sv_setpvn( ST(0), buf, length + 1);
+ sv_setpvn( ST(0), buf, length);
Safefree(buf);
X509 *