--- auth_pam.c.orig 2015-08-23 16:16:25.075000000 -0700 +++ auth_pam.c 2015-08-23 16:18:17.594000000 -0700 @@ -99,6 +99,9 @@ return PAM_CONV_ERR; /* allocate and copy the reply to the response array */ (*resp)[i].resp = strndup((char*)pkt, pkt_len); + if ( (*resp)[i].resp == NULL) { + return PAM_CONV_ERR; + } param->ptr = param->buf + 1; } }