Skip to content

Commit

Permalink
Fix null pointer derefence in non-debug builds
Browse files Browse the repository at this point in the history
xenbus_get_self_id() calls xenbus_read within BUG_ON, but BUG_ON(x)
resolves to nothing in non-debug builds, removing the call. This made
sscanf dereference a null value.
  • Loading branch information
Florian Schmidt committed Apr 21, 2016
1 parent 7b21e31 commit 868d075
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xenbus/xenbus.c
Expand Up @@ -833,7 +833,9 @@ domid_t xenbus_get_self_id(void)
char *dom_id;
domid_t ret;

BUG_ON(xenbus_read(XBT_NIL, "domid", &dom_id));
if (xenbus_read(XBT_NIL, "domid", &dom_id)) {
BUG_ON(1);
}
sscanf(dom_id, "%"SCNd16, &ret);

return ret;
Expand Down

0 comments on commit 868d075

Please sign in to comment.