Centralize packet sanity checks, and bound one value that was overflowing.

This commit is contained in:
Ian Gulliver
2016-02-26 14:55:43 -08:00
parent 207cd1e3a1
commit d6cb3afd9d
4 changed files with 17 additions and 7 deletions

View File

@@ -14,6 +14,7 @@
#include "buf.h"
#include "json.h"
#include "list.h"
#include "packet.h"
#include "peer.h"
#include "proto.h"
#include "raw.h"
@@ -146,6 +147,7 @@ void send_new_wrapper(int fd, void *passthrough, struct peer *on_close) {
}
void send_write(struct packet *packet) {
packet_sanity_check(packet);
for (size_t i = 0; i < NUM_SERIALIZERS; i++) {
struct serializer *serializer = &serializers[i];
if (list_is_empty(&serializer->send_head)) {