Module Name:    src
Committed By:   rin
Date:           Mon Nov  6 03:02:22 UTC 2017

Modified Files:
        src/external/bsd/nvi/dist/common: conv.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/common/conv.c

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

Modified files:

Index: src/external/bsd/nvi/dist/common/conv.c
diff -u src/external/bsd/nvi/dist/common/conv.c:1.4 src/external/bsd/nvi/dist/common/conv.c:1.5
--- src/external/bsd/nvi/dist/common/conv.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/common/conv.c	Mon Nov  6 03:02:22 2017
@@ -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 @@ raw2int(SCR *sp, const char * str, ssize
 	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;						\

Reply via email to