From b2c0ab76560757296ce387f6ff2c43c983e8961d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Fri, 30 Nov 2018 11:51:38 +0100
Subject: [PATCH 15/15] util: fix buffer error in textfile_copy()
Resolves:
https://github.com/pbrezina/authselect/issues/123
---
src/lib/util/textfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/util/textfile.c b/src/lib/util/textfile.c
index 7ee5df677b519f2433d9dfa235ad72551f7ded67..3394042eaf0db9508675cbd0aedc0cc13ea6546c 100644
--- a/src/lib/util/textfile.c
+++ b/src/lib/util/textfile.c
@@ -249,7 +249,7 @@ textfile_copy(const char *source,
/* eof not error */
}
- bytes_written = fwrite(buf, sizeof(char), sizeof(buf), fdest);
+ bytes_written = fwrite(buf, sizeof(char), bytes_read, fdest);
if (bytes_written != bytes_read) {
if (ferror(fdest) != 0) {
ret = EIO;
--
2.17.2