HomeClusterLabs Projects

Med: libcrmcommon: Fix a segfault in internal_ipc_get_reply.
da1cfb0a6706Unpublished

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.
This commit no longer exists in the repository. It may have been part of a branch which was deleted.This commit has been deleted in the repository: it is no longer reachable from any branch, tag, or ref.

Description

Med: libcrmcommon: Fix a segfault in internal_ipc_get_reply.

It's possible to fall out of the while loop without reading a reply from
a client, in which case client->buffer will be NULL since
pcmk__ipc_msg_append will never be called. In that case, we need to
check for NULL before accessing ->len.

There's another bug here, however. If we are reading a multi-part IPC
message and some part after the first one fails, *bytes will hold an
error code. But, client->buffer->len will still be positive since
pcmk__ipc_msg_append will have been called for the previous part. In
this case, we will take a partially received message as success.

This will fail when we try to parse the XML out of the partially
received message, but it's more obvious what's gone wrong if the reading
fails instead.

Details

Provenance
clumensAuthored on Mon, Aug 18, 2:35 PM

Event Timeline

Commit No Longer Exists

This commit no longer exists in the repository.