]> granicus.if.org Git - linux-pam/commit
libpam_misc: fix an inconsistency in handling memory allocation errors
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 22 Jan 2014 02:34:03 +0000 (02:34 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 22 Jan 2014 22:54:12 +0000 (22:54 +0000)
commitf760a6dc5853869d21051c7ed6015117941c1155
treeab7f6587a4e9f8c6fa28a57eced604c51f32ac4f
parent6b7558c8f88851ab954174e62d3b1e46cd2664b1
libpam_misc: fix an inconsistency in handling memory allocation errors

When misc_conv fails to allocate memory for pam_response array, it
returns PAM_CONV_ERR.  However, when read_string fails to allocate
memory for a response string, it loses the response string and silently
ignores the error, with net result as if EOF has been read.

* libpam_misc/misc_conv.c (read_string): Use strdup instead of x_strdup,
the latter is of no benefit in this case.
Do not ignore potential memory allocation errors returned by strdup,
forward them to misc_conv.
libpam_misc/misc_conv.c