From ff2c39e270e3e74cf6f0db33fe2547f077d60bf4 Mon Sep 17 00:00:00 2001 From: Benoit Gschwind Date: Fri, 30 Aug 2019 20:48:16 +0200 Subject: [PATCH] fix test order in convertLF and convertCRLF The new order of test avoid ready invalid memory address in ca.buf --- common/rfb/util.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/rfb/util.cxx b/common/rfb/util.cxx index fc4f4ca4..f310263d 100644 --- a/common/rfb/util.cxx +++ b/common/rfb/util.cxx @@ -127,7 +127,7 @@ namespace rfb { // Compute output size in = src; in_len = bytes; - while ((*in != '\0') && (in_len > 0)) { + while ((in_len > 0) && (*in != '\0')) { if (*in != '\r') { sz++; in++; @@ -150,7 +150,7 @@ namespace rfb { out = buffer; in = src; in_len = bytes; - while ((*in != '\0') && (in_len > 0)) { + while ((in_len > 0) && (*in != '\0')) { if (*in != '\r') { *out++ = *in++; in_len--; @@ -182,7 +182,7 @@ namespace rfb { // Compute output size in = src; in_len = bytes; - while ((*in != '\0') && (in_len > 0)) { + while ((in_len > 0) && (*in != '\0')) { sz++; if (*in == '\r') { @@ -205,7 +205,7 @@ namespace rfb { out = buffer; in = src; in_len = bytes; - while ((*in != '\0') && (in_len > 0)) { + while ((in_len > 0) && (*in != '\0')) { if (*in == '\n') { if ((in == src) || (*(in-1) != '\r')) *out++ = '\r'; -- 2.39.5