Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
* http.c: Stop if BIO_read returns <= 0
  • Loading branch information
graygnuorg committed Mar 19, 2018
1 parent 2f9efd5 commit c5a9578
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions http.c
Expand Up @@ -142,7 +142,7 @@ get_line(BIO *const in, char *const buf, const int bufsize)
if(tmp != '\n') {
/* we have CR not followed by NL */
do {
if(BIO_read(in, &tmp, 1) < 0)
if(BIO_read(in, &tmp, 1) <= 0)
return 1;
} while(tmp != '\n');
return 1;
Expand All @@ -169,15 +169,15 @@ get_line(BIO *const in, char *const buf, const int bufsize)

/* all other control characters cause an error */
do {
if(BIO_read(in, &tmp, 1) < 0)
if(BIO_read(in, &tmp, 1) <= 0)
return 1;
} while(tmp != '\n');
return 1;
}

/* line too long */
do {
if(BIO_read(in, &tmp, 1) < 0)
if(BIO_read(in, &tmp, 1) <= 0)
return 1;
} while(tmp != '\n');
return 1;
Expand Down

0 comments on commit c5a9578

Please sign in to comment.