summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-08-31 12:32:23 +0200
committerSimon Josefsson <simon@josefsson.org>2009-08-31 12:32:23 +0200
commit0e769157370b2bf25602b6fa81cb3ad06371e674 (patch)
tree7de55eee123e6f545a2dbf58f6f385d656ae7e3e
parente78b476ef131043fe8fec52d4e56b0f779e7aae8 (diff)
downloadgnutls-0e769157370b2bf25602b6fa81cb3ad06371e674.tar.gz
(cdk_strlist_next): Handle NULL root value better.
Based on report by Fabian Keil <fk@fabiankeil.de>.
-rw-r--r--lib/opencdk/misc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/opencdk/misc.c b/lib/opencdk/misc.c
index 50977bfd49..0df82a1f15 100644
--- a/lib/opencdk/misc.c
+++ b/lib/opencdk/misc.c
@@ -109,7 +109,7 @@ cdk_strlist_add (cdk_strlist_t * list, const char *string)
* cdk_strlist_next:
* @root: the opaque string list.
* @r_str: optional argument to store the string data.
- *
+ *
* Return the next string list node from @root. The optional
* argument @r_str return the data of the current (!) node.
**/
@@ -118,7 +118,10 @@ cdk_strlist_next (cdk_strlist_t root, const char **r_str)
{
cdk_strlist_t node;
- if (root && r_str)
+ if (!root)
+ return NULL;
+
+ if (r_str)
*r_str = root->d;
for (node = root->next; node; node = node->next)
return node;