Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssh/dist Separate strings correctly ...



details:   https://anonhg.NetBSD.org/src/rev/4b631be7edfe
branches:  trunk
changeset: 770961:4b631be7edfe
user:      joerg <joerg%NetBSD.org@localhost>
date:      Fri Nov 04 11:54:46 2011 +0000

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

diffstat:

 crypto/external/bsd/openssh/dist/log.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (36 lines):

diff -r af29a3693a08 -r 4b631be7edfe crypto/external/bsd/openssh/dist/log.c
--- a/crypto/external/bsd/openssh/dist/log.c    Fri Nov 04 11:27:00 2011 +0000
+++ b/crypto/external/bsd/openssh/dist/log.c    Fri Nov 04 11:54:46 2011 +0000
@@ -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 <ylo%cs.hut.fi@localhost>
@@ -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 @@
        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);



Home | Main Index | Thread Index | Old Index