On Mon, Dec 10, 2018 at 05:01:47PM +0100, Tomas Mraz wrote:
The attached patch moves the implementation of search_key function
that
was duplicated in multiple PAM modules into a new
pam_modutil_search_key function.
I plan to add one more place where it will be used - pam_lastlog.
OK to commit?
[...]
+ tmp = strsep (&cp, " \t=");
+ if (cp != NULL)
+ while (isspace((int)*cp) || *cp == '=')
+ ++cp;
+
+ if (strcasecmp(tmp, key) == 0) {
+ retval = strdup(cp);
+ break;
+ }
This piece of code looks problematic:
if the string contains a key without a value, you'll get cp == NULL
and will end up with strdup(NULL).
--
ldv