[python-ldap] [PATCH] Fix check for an empty error message

Bradley Baetz bbaetz at google.com
Thu Jan 5 18:09:33 EST 2017


When trying to get the server's error message, check if the string is empty
rather than checking the pointer against '\0'. (This is already
NULL-checked in the previous line)

Thanks,

Bradley Index: Modules/errors.c ==============================
===================================== RCS file:
/cvsroot/python-ldap/python-ldap/Modules/errors.c,v
retrieving revision 1.25 diff -u -r1.25 errors.c --- Modules/errors.c 23
Jun 2015 09:45:09 -0000 1.25 +++ Modules/errors.c 5 Jan 2017 00:22:35 -0000
@@ -98,7 +98,7 @@ Py_XDECREF(str); } else if (ldap_get_option(l,
LDAP_OPT_ERROR_STRING, &error) >= 0 && error != NULL) { - if (error !=
'\0') { + if (*error != '\0') { str = PyString_FromString(error); if (str)
PyDict_SetItemString( info, "info", str );
-- 

Bradley Baetz | Site Reliability Manager | bbaetz at google.com |
 +61-416-080841
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170105/caaf9902/attachment.html>


More information about the python-ldap mailing list