The branch, master has been updated via 91227b3 libpamtest: Do not declare variable in for-loop via 7dce9b5 pypamtest: Add sanity checks in new_conv_list() via 14adde1 pypamtest: Do not use variable declaration in for-loop from b6708f7 cmake: Add Python 3.6 if we look for the python library
https://git.samba.org/?p=pam_wrapper.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 91227b3056ef7c16b5c6ea7515f4f1b65feca859 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 6 09:15:07 2017 +0200 libpamtest: Do not declare variable in for-loop Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 7dce9b5147cb699a1972590b1fb8262a4aa64b18 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 6 09:13:40 2017 +0200 pypamtest: Add sanity checks in new_conv_list() Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 14adde1d0ea2069b546278529a5e13e113303f51 Author: Andreas Schneider <a...@samba.org> Date: Thu Apr 6 09:09:53 2017 +0200 pypamtest: Do not use variable declaration in for-loop Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: src/libpamtest.c | 4 +++- src/python/pypamtest.c | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) Changeset truncated at 500 lines: diff --git a/src/libpamtest.c b/src/libpamtest.c index 7119184..c0ab41d 100644 --- a/src/libpamtest.c +++ b/src/libpamtest.c @@ -117,11 +117,13 @@ enum pamtest_err _pamtest_conv(const char *service, void pamtest_free_env(char **envlist) { + size_t i; + if (envlist == NULL) { return; } - for (size_t i = 0; envlist[i] != NULL; i++) { + for (i = 0; envlist[i] != NULL; i++) { free(envlist[i]); } free(envlist); diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c index a1b3054..585f27d 100644 --- a/src/python/pypamtest.c +++ b/src/python/pypamtest.c @@ -133,9 +133,18 @@ static void free_string_list(char **list) PyMem_Free(list); } -static char **new_conv_list(const int list_size) +static char **new_conv_list(const size_t list_size) { char **list; + size_t i; + + if (list_size == 0) { + return NULL; + } + + if (list_size + 1 < list_size) { + return NULL; + } list = PyMem_New(char *, list_size + 1); if (list == NULL) { @@ -143,7 +152,7 @@ static char **new_conv_list(const int list_size) } list[list_size] = NULL; - for (int i =0; i < list_size; i++) { + for (i = 0; i < list_size; i++) { list[i] = PyMem_New(char, PAM_MAX_MSG_SIZE); if (list[i] == NULL) { PyMem_Free(list); -- pam wrapper repository