Commit Graph

6 Commits

Author SHA1 Message Date
Marcelo Araujo
85a9cb4440 Simplify parseval() by allocating a buffer the size of the input string,
which will always be big enough to hold the output string.

Obtained from:	OpenBSD (revision 1.36)
2017-05-26 03:27:06 +00:00
Marcelo Araujo
5902259135 String terminators are called NUL, not NULL, also the variable
mentioned in the comment is p and not u.

Obtained from:	OpenBSD (r1.34)
2016-12-02 05:49:22 +00:00
Don Lewis
9d80a8b09e Fix Coverity CIDs 1340544 Resource leak and 1340543 Use after free
At line 479 of ldapclient.c in client_build_req(), the error return
leaks ldap_attrs (CID 1340544).  It looks like this can happen if
the first utoa() call in aldap_get_stringset() fails.  It looks
like other leaks can happen if other utoa() calls fail since scanning
this array when it is freed stops when the first NULL is encountered.
Fix these problems by not storing NULL in the array when utoa()
fails, and by freeing ret and returning NULL if nothing is stored
in the array.  That way the caller will never see the
ldap_attrs[0] == NULL case, so delete that check.

The ber_printf_element() calls ber_free_elements() on its ber
argument and returns NULL on failure.  When each of its callers
detects failure, they do a goto fail, which then calls ber_free_elements()
with the same pointer (CID 1340543).  Fix is to delete the
ber_free_elements() from ber_printf_element()

Reported by:	Coverity
CID:		1340543, 1340544
Reviewed by:	araujo
Differential Revision:	https://reviews.freebsd.org/D6550
2016-05-25 01:37:25 +00:00
Marcelo Araujo
eed7cf8d2d Simplify overengineered and buggy code that looked like as if it did
some kind of UTF-8 validation, but actually didn't, but instead, for
malformed UTF-8 input, caused buffer overruns in some cases and caused
skipping of valid ASCII characters in other cases.

Obtained from:	OpenBSD (cvs 1.32)
2016-05-16 02:44:22 +00:00
Marcelo Araujo
84e29f233a Remove the null checker before free.
Approved by:	bapt (mentor)
Obtained from:	OpenBSD
Differential Revision:	https://reviews.freebsd.org/D4549
2015-12-15 15:42:42 +00:00
Craig Rodrigues
9e7c127f8d Import ypldap from OpenBSD.
ypldap -- Intended to be a drop-in replacement for ypserv, gluing in a
LDAP directory and thus providing support for users and groups stored in
LDAP for the get{pw,gr}ent family of functions.
2015-11-16 16:48:43 +00:00