tStop bufferizing on end-of-file - sick - sign and check files using ed25519
(HTM) git clone git://z3bra.org/sick
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 64c338df3e9e8f8e4d407f4fe1d1811ece190752
(DIR) parent b9f3b5b125d654314a9b5964d7728b4e7222fd63
(HTM) Author: z3bra <contactatz3bradotorg>
Date: Mon, 13 Mar 2017 22:52:24 +0100
Stop bufferizing on end-of-file
Diffstat:
M sick.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
(DIR) diff --git a/sick.c b/sick.c
t@@ -88,7 +88,7 @@ bufferize(char **buf, FILE *fp)
* For each chunk read, reallocate the buffer size to fit the newly
* read data, and copy it over
*/
- while ((n = fread(chunk, 1, _POSIX_MAX_INPUT, fp)) > 0) {
+ while (!feof(fp) && (n = fread(chunk, 1, _POSIX_MAX_INPUT, fp)) > 0) {
if ((tmp = realloc(*buf, len + n)) == NULL) {
free(*buf);
*buf = NULL;