diff options
author | Chris Luke <chrisy@flirble.org> | 2017-09-26 13:15:16 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-09-27 17:08:08 +0000 |
commit | 879ace3d3b238ec8db80f52ebfd556aa6f12b4c7 (patch) | |
tree | 1222ac207c4ffdad33ee52de5e151a053c78ac5c /src/uri | |
parent | 987abe9eeb65a3950401073c770012a7898593b7 (diff) |
Various fixes for issues found by Coverity (VPP-972)
174267: Revisit this string termination issue
174816: Add check for NULL when trace is enabled
177211: Add notation that mutex is not required here
177117: Added check for log2_page_size == 0 and returns an error if so
163697,163698: Added missing sw_if_index validation
Change-Id: I5a76fcf6505c785bfb3269e353360031c6a0fd0f
Signed-off-by: Chris Luke <chrisy@flirble.org>
Diffstat (limited to 'src/uri')
-rw-r--r-- | src/uri/sock_test_server.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/uri/sock_test_server.c b/src/uri/sock_test_server.c index 29adea2574a..35046aa061b 100644 --- a/src/uri/sock_test_server.c +++ b/src/uri/sock_test_server.c @@ -514,7 +514,7 @@ main (int argc, char **argv) continue; } - else if (((char *) conn->buf)[0] != 0) + else if (isascii (conn->buf[0])) { // If it looks vaguely like a string, make sure it's terminated ((char *) conn->buf)[rx_bytes < @@ -536,8 +536,12 @@ main (int argc, char **argv) continue; } - if (isascii (conn->buf[0]) && strlen ((const char *) conn->buf)) + if (isascii (conn->buf[0])) { + // If it looks vaguely like a string, make sure it's terminated + ((char *) conn->buf)[rx_bytes < + conn->buf_size ? rx_bytes : + conn->buf_size - 1] = 0; if (xtra) fprintf (stderr, "ERROR: FIFO not drained in previous test!\n" |