[MPlayer-dev-eng] [PATCH 1/7] stream ftp: readline: Fix off-by-one error
Alexander Strasser
eclipse7 at gmx.net
Sun Nov 11 22:00:50 CET 2012
Even if max bytes are available read at most max - 1 bytes.
Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>
---
stream/stream_ftp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stream/stream_ftp.c b/stream/stream_ftp.c
index 6e431a9..0bb0711 100644
--- a/stream/stream_ftp.c
+++ b/stream/stream_ftp.c
@@ -114,7 +114,7 @@ static int readline(char *buf,int max,struct stream_priv_s *ctl)
do {
if (ctl->cavail > 0) {
- x = (max >= ctl->cavail) ? ctl->cavail : max-1;
+ x = (max > ctl->cavail) ? ctl->cavail : max-1;
end = memccpy(bp,ctl->cget,'\n',x);
if (end != NULL)
x = end - bp;
--
1.7.10.2.552.gaa3bb87
More information about the MPlayer-dev-eng
mailing list