From a84019cf10ab52e164d3a7c4c751f3801aa4eae0 Mon Sep 17 00:00:00 2001 From: thorkill Date: Wed, 11 May 2016 18:50:12 +0200 Subject: [PATCH] Split error handling for accurate log messages in sptps_verify_datagram "Received short packet" was misleading. --- src/sptps.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sptps.c b/src/sptps.c index 1425f9a8..f08f1389 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -467,8 +467,10 @@ static bool sptps_check_seqno(sptps_t *s, uint32_t seqno, bool update_state) { // Check datagram for valid HMAC bool sptps_verify_datagram(sptps_t *s, const void *data, size_t len) { - if(!s->instate || len < 21) - return error(s, EIO, "Received short packet"); + if(!s->instate) + return error(s, EIO, "%s@%d: Invalid instate", __FUNCTION__, __LINE__); + if(len < 21) + return error(s, EIO, "%s@%d: Received short packet", __FUNCTION__, __LINE__); uint32_t seqno; memcpy(&seqno, data, 4);