Commit c2edb62b authored by Richard Levitte's avatar Richard Levitte
Browse files

Make sure to NUL-terminate the string on end-of-file (and error)

PR: 643
parent 0a02757b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -169,6 +169,7 @@ start:
			if (i <= 0)
				{
				BIO_copy_next_retry(b);
				*buf='\0';
				if (i < 0) return((num > 0)?num:i);
				if (i == 0) return(num);
				}
@@ -495,6 +496,9 @@ static int buffer_gets(BIO *b, char *buf, int size)
			if (i <= 0)
				{
				BIO_copy_next_retry(b);
				*buf='\0';
				fprintf(stderr, "DEBUG[buffer_gets]: i = %d\n",
					i);
				if (i < 0) return((num > 0)?num:i);
				if (i == 0) return(num);
				}