aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-04-06 09:13:40 +0200
committerAndreas Schneider <asn@samba.org>2017-04-06 09:20:23 +0200
commit7dce9b5147cb699a1972590b1fb8262a4aa64b18 (patch)
treeca445d83b946e57b4bf7c625f42757a96d98a56e
parent14adde1d0ea2069b546278529a5e13e113303f51 (diff)
downloadpam_wrapper-7dce9b5147cb699a1972590b1fb8262a4aa64b18.tar.gz
pam_wrapper-7dce9b5147cb699a1972590b1fb8262a4aa64b18.tar.xz
pam_wrapper-7dce9b5147cb699a1972590b1fb8262a4aa64b18.zip
pypamtest: Add sanity checks in new_conv_list()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--src/python/pypamtest.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/python/pypamtest.c b/src/python/pypamtest.c
index 2a2f7c4..585f27d 100644
--- a/src/python/pypamtest.c
+++ b/src/python/pypamtest.c
@@ -133,10 +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;
- int i;
+ 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) {