From ad06d232a6e54179d1615241b273bc18ab08805c Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Fri, 4 Dec 2020 18:27:55 +0800 Subject: [PATCH] This may fix #1268 --- lualib-src/sproto/sproto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lualib-src/sproto/sproto.c b/lualib-src/sproto/sproto.c index 0b7f4132..47d1527b 100644 --- a/lualib-src/sproto/sproto.c +++ b/lualib-src/sproto/sproto.c @@ -1386,7 +1386,7 @@ sproto_unpack(const void * srcv, int srcsz, void * bufferv, int bufsz) { ++src; if (header == 0xff) { int n; - if (srcsz < 0) { + if (srcsz <= 0) { return -1; } n = (src[0] + 1) * 8; @@ -1406,7 +1406,7 @@ sproto_unpack(const void * srcv, int srcsz, void * bufferv, int bufsz) { for (i=0;i<8;i++) { int nz = (header >> i) & 1; if (nz) { - if (srcsz < 0) + if (srcsz <= 0) return -1; if (bufsz > 0) { *buffer = *src;