aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Triplett <josh@freedesktop.org>2007-03-10 11:10:42 -0800
committerJosh Triplett <josh@freedesktop.org>2007-03-10 11:11:32 -0800
commit3a4fdb5865f8ded10b51dc06631c30710d104a6c (patch)
tree1cc59671b80bf8d641bfad4154817e3d486abd70 /dissect.c
parentUse GCC format and sentinel attributes on appropriate functions (diff)
downloadsparse-3a4fdb5865f8ded10b51dc06631c30710d104a6c.tar.gz
sparse-3a4fdb5865f8ded10b51dc06631c30710d104a6c.tar.bz2
sparse-3a4fdb5865f8ded10b51dc06631c30710d104a6c.zip
Fix two potential NULL pointer dereferences in dissect.c
mk_name in dissect.c used ?: to check for NULL pointers in two arguments of an snprintf call, but then just dereferenced the pointers in the other two parts of the same call. Thanks to Florian Krohm of IBM for reporting the problem. Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'dissect.c')
-rw-r--r--dissect.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dissect.c b/dissect.c
index 91aecf3..9dc3df9 100644
--- a/dissect.c
+++ b/dissect.c
@@ -179,8 +179,8 @@ static inline struct ident *mk_name(struct ident *root, struct ident *node)
char name[256];
snprintf(name, sizeof(name), "%.*s:%.*s",
- root ? root->len : 0, root->name,
- node ? node->len : 0, node->name);
+ root ? root->len : 0, root ? root->name : "",
+ node ? node->len : 0, node ? node->name : "");
return built_in_ident(name);
}