Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion 11 Modules/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,18 @@ LDAPraise_for_message(LDAP *l, LDAPMessage *m)
}

if (errnum == LDAP_REFERRAL && refs != NULL && refs[0] != NULL) {
/* Return all referrals as a list in "reflist" */
PyObject *referralList = PyList_New(0);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check.

int i = 0;
while (refs[i] != NULL) {
PyObject *referralURL = Py_BuildValue("s", refs[i++]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use PyUnicode_FromString() and check for error (NULL).

PyList_Append(referralList, referralURL);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check.

Py_XDECREF(referralURL);
}
PyDict_SetItemString(info, "reflist", referralList);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check

Py_XDECREF(referralList);
/* Keep old behaviour, overshadow error message */
char err[1024];

snprintf(err, sizeof(err), "Referral:\n%s", refs[0]);
str = PyUnicode_FromString(err);
PyDict_SetItemString(info, "info", str);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.