Skip to content

Commit

Permalink
Fix possible null deref
Browse files Browse the repository at this point in the history
  • Loading branch information
wooffie committed Feb 24, 2025
1 parent 07df538 commit e490568
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pub.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,12 @@ natsConnection_PublishString(natsConnection *nc, const char *subj,
natsStatus
natsConnection_PublishMsg(natsConnection *nc, natsMsg *msg)
{
const char *reply = (msg != NULL ? msg->reply : NULL);
natsStatus s;

s = _publishMsg(nc, msg, reply);
if (nc == NULL || msg == NULL)
return nats_setDefaultError(NATS_INVALID_ARG);

s = _publishMsg(nc, msg, NULL);
return NATS_UPDATE_ERR_STACK(s);
}

Expand Down

0 comments on commit e490568

Please sign in to comment.