aboutsummaryrefslogtreecommitdiffhomepage
path: root/mime-node.c
diff options
context:
space:
mode:
authorGravatar Justus Winter <4winter@informatik.uni-hamburg.de>2012-09-24 17:21:20 +0200
committerGravatar David Bremner <bremner@debian.org>2012-09-27 12:52:34 -0300
commitb6b08e40b38b098e796c2846c150befc8cc2c350 (patch)
treee9c47e6694e4e1feaa5db976775f55889f9ca2e5 /mime-node.c
parent2f40ca28a4d63df941525801735d05b5b2b86f91 (diff)
Avoid potentially dereferencing a NULL pointer
GMIME_IS_MULTIPART and GMIME_IS_MESSAGE both handle NULL pointers gracefully, but the G_OBJECT_TYPE used in the error handling block dereferences it without checking it first. Fix this by checking whether parent->part is valid. Found using the clang static analyzer. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Diffstat (limited to 'mime-node.c')
-rw-r--r--mime-node.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mime-node.c b/mime-node.c
index 97e8b480..839737a8 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -291,7 +291,7 @@ mime_node_child (mime_node_t *parent, int child)
GMimeObject *sub;
mime_node_t *node;
- if (!parent || child < 0 || child >= parent->nchildren)
+ if (!parent || !parent->part || child < 0 || child >= parent->nchildren)
return NULL;
if (GMIME_IS_MULTIPART (parent->part)) {