Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/nvi/dist/common Fix buffer overrun caused by li...



details:   https://anonhg.NetBSD.org/src/rev/c4a85bb02e88
branches:  trunk
changeset: 827621:c4a85bb02e88
user:      rin <rin%NetBSD.org@localhost>
date:      Mon Nov 06 03:02:22 2017 +0000

description:
Fix buffer overrun caused by lines longer than CONV_BUFFER_SIZE.
Take care of errno == E2BIG case of iconv(3) appropriately.

diffstat:

 external/bsd/nvi/dist/common/conv.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r aa9969abb087 -r c4a85bb02e88 external/bsd/nvi/dist/common/conv.c
--- a/external/bsd/nvi/dist/common/conv.c       Mon Nov 06 02:57:18 2017 +0000
+++ b/external/bsd/nvi/dist/common/conv.c       Mon Nov 06 03:02:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conv.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*     $NetBSD: conv.c,v 1.5 2017/11/06 03:02:22 rin Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: conv.c,v 1.27 2001/08/18 21:41:41 skimo Exp  (Berkeley) Date: 2001/08/18 21:41:41 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: conv.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: conv.c,v 1.5 2017/11/06 03:02:22 rin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -96,7 +96,7 @@
        outleft = CONV_BUFFER_SIZE;                                     \
        errno = 0;                                                      \
        if (iconv(id, (const char **)&str, &left, &bp, &outleft)        \
-           == (size_t)-1 /* && errno != E2BIG */)                      \
+           == (size_t)-1 && errno != E2BIG)                            \
                HANDLE_ICONV_ERROR(bp, str, outleft, left);             \
        if ((len = CONV_BUFFER_SIZE - outleft) == 0) {                  \
            error = -left;                                              \



Home | Main Index | Thread Index | Old Index