lib: fix length check in safe_sendmsg
PATCH 1/1 lib: fix length check in safe_sendmsg
It appears that we only check the len parameter against the return value if the len parameter is zero.
Signed-off-by Richard Palethorpe <[email protected]>
--- lib/safe_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/safe_net.c +1 -1
@@ -200,7 +200,7 @@ ssize_t safe_sendmsg(const char *file, const int lineno, size_t len, file, lineno, sockfd, msg, flags); } -if (!len && (size_t )rval != len) { +if (len && (size_t )rval != len) {tst_brkm (TBROK ,NULL ,"%s:%d: sendmsg(%d, %p, %d) ret(%zd) != len(%zu)" , file, lineno, sockfd, msg, flags, rval, len);
Signature · 1 line
2.16.2
Alexey Kodanev
AppliedPATCH 1/1 lib: fix length check in safe_sendmsg
Quoted 14 lines · Richard Palethorpe
It appears that we only check the len parameter against the return value if the len parameter is zero.
Signed-off-by Richard Palethorpe <[email protected]>--- lib/safe_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/safe_net.c +0
-0
lib/safe_net.c ssize_t safe_sendmsg(const char *file, const int lineno, size_t len, · line 206
Quoted 8 lines
lib/safe_net.c +1
-1@@ -200,7 +200,7 @@ ssize_t safe_sendmsg(const char *file, const int lineno, size_t len, file, lineno, sockfd, msg, flags); } -if (!len && (size_t )rval != len) { +if (len && (size_t )rval != len) {tst_brkm (TBROK ,NULL ,"%s:%d: sendmsg(%d, %p, %d) ret(%zd) != len(%zu)" , file, lineno, sockfd, msg, flags, rval, len);
Applied. Nice catch, thank you Richard!