| 21 | } |
| 22 | |
| 23 | const u8 *fromwire(const u8 **cursor, size_t *max, void *copy, size_t n) |
| 24 | { |
| 25 | const u8 *p = *cursor; |
| 26 | |
| 27 | if (*max < n) { |
| 28 | /* Just make sure we don't leak uninitialized mem! */ |
| 29 | if (copy) |
| 30 | memset(copy, 0, n); |
| 31 | if (*cursor) |
| 32 | SUPERVERBOSE("less than encoding length"); |
| 33 | return fromwire_fail(cursor, max); |
| 34 | } |
| 35 | /* ubsan: runtime error: applying zero offset to null pointer */ |
| 36 | if (*cursor) |
| 37 | *cursor += n; |
| 38 | *max -= n; |
| 39 | if (copy && n) |
| 40 | memcpy(copy, p, n); |
| 41 | return memcheck(p, n); |
| 42 | } |
| 43 | |
| 44 | int fromwire_peektypen(const u8 *cursor, size_t max) |
| 45 | { |
no test coverage detected