diff options
author | Benoit Gschwind <gschwind@gnu-log.net> | 2019-08-30 20:48:16 +0200 |
---|---|---|
committer | Benoit Gschwind <gschwind@gnu-log.net> | 2019-08-30 20:55:30 +0200 |
commit | ff2c39e270e3e74cf6f0db33fe2547f077d60bf4 (patch) | |
tree | 7f23044c5e5987795daa61fa7d16869eeb465068 | |
parent | ae5d92e1a9bf39692095cb54ec7637fc68781408 (diff) | |
download | tigervnc-ff2c39e270e3e74cf6f0db33fe2547f077d60bf4.tar.gz tigervnc-ff2c39e270e3e74cf6f0db33fe2547f077d60bf4.zip |
fix test order in convertLF and convertCRLF
The new order of test avoid ready invalid memory address in ca.buf
-rw-r--r-- | common/rfb/util.cxx | 8 |
1 files 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'; |