aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-02-03 13:18:16 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-02-03 13:19:24 +0100
commitce029c0735a210ee544a6fe7d752e518f6699c16 (patch)
treeaab44918abf047e5e1a091f1d2f3852e5f64a17e
parent8a2deeb3ccb18e99c78fb881ff4fe8cb516d2318 (diff)
downloadlibssh-ce029c0735a210ee544a6fe7d752e518f6699c16.tar.gz
libssh-ce029c0735a210ee544a6fe7d752e518f6699c16.tar.xz
libssh-ce029c0735a210ee544a6fe7d752e518f6699c16.zip
pki: Use byte mode for fopen()
BUG: https://red.libssh.org/issues/251 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> (cherry picked from commit de369b46b1877d0f5546013518ef2a46932d6757)
-rw-r--r--src/pki.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pki.c b/src/pki.c
index 5b26579d..49e10b65 100644
--- a/src/pki.c
+++ b/src/pki.c
@@ -955,7 +955,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
return SSH_ERROR;
}
- file = fopen(filename, "r");
+ file = fopen(filename, "rb");
if (file == NULL) {
ssh_pki_log("Error opening %s: %s",
filename, strerror(errno));
@@ -1233,7 +1233,7 @@ int ssh_pki_export_pubkey_file(const ssh_key key,
return SSH_ERROR;
}
- fp = fopen(filename, "w+");
+ fp = fopen(filename, "wb+");
if (fp == NULL) {
return SSH_ERROR;
}