Append to commando->contents: set to NULL if we've over max. */
| 111 | |
| 112 | /* Append to commando->contents: set to NULL if we've over max. */ |
| 113 | static void append_contents(struct commando *commando, const u8 *msg, size_t msglen, |
| 114 | size_t maxlen) |
| 115 | { |
| 116 | size_t len = tal_count(commando->contents); |
| 117 | |
| 118 | if (!commando->contents) |
| 119 | return; |
| 120 | |
| 121 | if (len + msglen > maxlen) { |
| 122 | commando->contents = tal_free(commando->contents); |
| 123 | return; |
| 124 | } |
| 125 | |
| 126 | tal_resize(&commando->contents, len + msglen); |
| 127 | memcpy(commando->contents + len, msg, msglen); |
| 128 | } |
| 129 | |
| 130 | struct reply { |
| 131 | struct commando *incoming; |
no test coverage detected