mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Prevent null dereference
In each case there are scenarios where we would have dereferenced NULL. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
18d52ec86e
commit
66375689b8
2 changed files with 7 additions and 8 deletions
13
file.c
13
file.c
|
@ -499,7 +499,7 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
|
|||
terminator = '\r';
|
||||
}
|
||||
*endptr = 0;
|
||||
ret = strdup(valueptr);
|
||||
ret = copy_string(valueptr);
|
||||
*endptr = terminator;
|
||||
|
||||
}
|
||||
|
@ -513,12 +513,11 @@ char *next_mkvi_key(const char *haystack)
|
|||
|
||||
if ((valueptr = strstr(haystack, "\n")) != NULL) {
|
||||
valueptr += 1;
|
||||
}
|
||||
if ((endptr = strstr(valueptr, ": ")) != NULL) {
|
||||
*endptr = 0;
|
||||
ret = strdup(valueptr);
|
||||
*endptr = ':';
|
||||
|
||||
if ((endptr = strstr(valueptr, ": ")) != NULL) {
|
||||
*endptr = 0;
|
||||
ret = strdup(valueptr);
|
||||
*endptr = ':';
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1762,7 +1762,7 @@ static const char *nodename(xmlNode *node, char *buf, int len)
|
|||
int levels = 2;
|
||||
char *p = buf;
|
||||
|
||||
if (node->type != XML_CDATA_SECTION_NODE && (!node || !node->name)) {
|
||||
if (!node || (node->type != XML_CDATA_SECTION_NODE && !node->name)) {
|
||||
return "root";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue