summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authordjm <djm>2007-01-05 05:24:47 +0000
committerdjm <djm>2007-01-05 05:24:47 +0000
commite2e863e3f47830a6a51c064f77cf2ed5feaa0d8e (patch)
tree90d3be7fb2ef686c93287a952145686c5162f141 /misc.c
parente805e7c040578acd4286c763eea90e0aacdcc711 (diff)
downloadopenssh-e2e863e3f47830a6a51c064f77cf2ed5feaa0d8e.tar.gz
- ray@cvs.openbsd.org 2006/11/23 01:35:11
[misc.c sftp.c] Don't access buf[strlen(buf) - 1] for zero-length strings. ``ok by me'' djm@.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc.c b/misc.c
index 78bca2fa..625a3436 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.64 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.65 2006/11/23 01:35:11 ray Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -616,6 +616,8 @@ read_keyfile_line(FILE *f, const char *filename, char *buf, size_t bufsz,
u_long *lineno)
{
while (fgets(buf, bufsz, f) != NULL) {
+ if (buf[0] == '\0')
+ continue;
(*lineno)++;
if (buf[strlen(buf) - 1] == '\n' || feof(f)) {
return 0;