Skip to content

Commit c69cf93

Browse files
committed
MDEV-8673 - [PATCH] Missing Sanity Check for strndup() in MariaDB 10.0.2x
Contributed by Bill Parker. Added check for strndup() return value.
1 parent 173e486 commit c69cf93

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugin/auth_pam/auth_pam.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ static int conv(int n, const struct pam_message **msg,
9898
if (pkt_len < 0)
9999
return PAM_CONV_ERR;
100100
/* allocate and copy the reply to the response array */
101-
(*resp)[i].resp = strndup((char*)pkt, pkt_len);
101+
if (!((*resp)[i].resp= strndup((char*) pkt, pkt_len)))
102+
return PAM_CONV_ERR;
102103
param->ptr = param->buf + 1;
103104
}
104105
}

0 commit comments

Comments
 (0)