Skip to content

Commit

Permalink
broker/module: comment unchecked snprintf
Browse files Browse the repository at this point in the history
Problem: an snprintf() return value is not checked.

Cast to void and add a comment explaining why it cannot fail.
  • Loading branch information
garlick committed Sep 18, 2023
1 parent df719c7 commit 7c21568
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/broker/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,11 @@ module_t *module_create (flux_t *h,
}
zsock_set_unbounded (p->sock);
zsock_set_linger (p->sock, 5);
snprintf (p->endpoint,
sizeof (p->endpoint),
"inproc://%s",
module_get_uuid (p));
// copying 9 + 37 + 1 = 47 bytes into 128 byte buffer cannot fail
(void)snprintf (p->endpoint,
sizeof (p->endpoint),
"inproc://%s",
module_get_uuid (p));
if (zmq_bind (p->sock, p->endpoint) < 0) {
errprintf (error, "zmq_bind %s: %s", p->endpoint, strerror (errno));
goto cleanup;
Expand Down

0 comments on commit 7c21568

Please sign in to comment.