]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authordjm@openbsd.org <djm@openbsd.org>
Mon, 30 Mar 2015 00:00:29 +0000 (00:00 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 30 Mar 2015 00:01:08 +0000 (11:01 +1100)
fix uninitialised memory read when parsing a config file
 consisting of a single nul byte. Found by hanno AT hboeck.de using AFL; ok
 dtucker

readconf.c

index 42a2961faead7dc72351133d8cb79f2a5bd2bcb7..9e15f27bb4bd63a570099e2d5a62c64641b2a7bb 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.232 2015/02/16 22:13:32 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.233 2015/03/30 00:00:29 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -763,7 +763,9 @@ process_config_line(Options *options, struct passwd *pw, const char *host,
        }
 
        /* Strip trailing whitespace */
-       for (len = strlen(line) - 1; len > 0; len--) {
+       if ((len = strlen(line)) == 0)
+               return 0;
+       for (len--; len > 0; len--) {
                if (strchr(WHITESPACE, line[len]) == NULL)
                        break;
                line[len] = '\0';