From 42df6475c8eb053de1af15f5a5dbf4b67cf935b2 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 21 Nov 2018 20:36:49 -0800 Subject: [PATCH] Catch forgetting to initialize packetSize field --- src/Connection.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Connection.c b/src/Connection.c index 65fe4c1..14d0792 100644 --- a/src/Connection.c +++ b/src/Connection.c @@ -176,11 +176,18 @@ int LiStartConnection(PSERVER_INFORMATION serverInfo, PSTREAM_CONFIGURATION stre // FEC only works in 16 byte chunks, so we must round down // the given packet size to the nearest multiple of 16. StreamConfig.packetSize -= StreamConfig.packetSize % 16; + + if (StreamConfig.packetSize == 0) { + Limelog("Invalid packet size specified\n"); + free(RemoteAddrString); + return -1; + } // Extract the appversion from the supplied string if (extractVersionQuadFromString(serverInfo->serverInfoAppVersion, AppVersionQuad) < 0) { Limelog("Invalid appversion string: %s\n", serverInfo->serverInfoAppVersion); + free(RemoteAddrString); return -1; }