From: Etienne Dechamps Date: Sun, 8 Mar 2015 17:32:39 +0000 (+0000) Subject: Don't abort() willy-nilly in SPTPS code. X-Git-Tag: release-1.1pre12~197^2 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=2e7f68ad2b51648b89c4b5c61aeb4cec67c2fbbb;p=tinc Don't abort() willy-nilly in SPTPS code. If receive_handshake() or the receive_record() user callback returns an error, sptps_receive_data_datagram() crashes the entire process. This is heavy-handed, makes tinc very brittle to certain failures (i.e. unexpected packets), and is inconsistent with the rest of SPTPS code. --- diff --git a/src/sptps.c b/src/sptps.c index a5987682..4a9683f2 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -483,10 +483,10 @@ static bool sptps_receive_data_datagram(sptps_t *s, const char *data, size_t len if(!s->instate) return error(s, EIO, "Application record received before handshake finished"); if(!s->receive_record(s->handle, type, buffer + 1, len - 21)) - abort(); + return false; } else if(type == SPTPS_HANDSHAKE) { if(!receive_handshake(s, buffer + 1, len - 21)) - abort(); + return false; } else { return error(s, EIO, "Invalid record type %d", type); }