Module Name:    src
Committed By:   joerg
Date:           Fri Nov  4 11:54:46 UTC 2011

Modified Files:
        src/crypto/external/bsd/openssh/dist: log.c

Log Message:
Separate strings correctly with ': ', not embedded NUL. Found by
mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/crypto/external/bsd/openssh/dist/log.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssh/dist/log.c
diff -u src/crypto/external/bsd/openssh/dist/log.c:1.6 src/crypto/external/bsd/openssh/dist/log.c:1.7
--- src/crypto/external/bsd/openssh/dist/log.c:1.6	Fri Sep 16 15:36:00 2011
+++ src/crypto/external/bsd/openssh/dist/log.c	Fri Nov  4 11:54:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $	*/
+/*	$NetBSD: log.c,v 1.7 2011/11/04 11:54:46 joerg Exp $	*/
 /* $OpenBSD: log.c,v 1.42 2011/06/17 21:44:30 djm Exp $ */
 /*
  * Author: Tatu Ylonen <[email protected]>
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $");
+__RCSID("$NetBSD: log.c,v 1.7 2011/11/04 11:54:46 joerg Exp $");
 #include <sys/types.h>
 #include <sys/uio.h>
 
@@ -375,12 +375,13 @@ do_log(LogLevel level, const char *fmt, 
 	msgbufp = msgbuf;
 	if (txt != NULL && log_handler == NULL) {
 		len2 = strlen(txt);
-		if (len2 >= len)
-			len2 = len - 1;
+		if (len2 > len - 2)
+			len2 = len - 2;
 		memcpy(msgbufp, txt, len2);
 		msgbufp += len2;
-		*msgbufp++ = '\0';
-		len -= len2 + 1;
+		*msgbufp++ = ':';
+		*msgbufp++ = ' ';
+		len -= len2 + 2;
 	}
 	vsnprintf(msgbufp, len, fmt, args);
 	len3 = strnvis(visbuf, sizeof(visbuf), msgbuf, VIS_SAFE|VIS_OCTAL);

Reply via email to