Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit From Kamil Dudka: fix crash of el_insertstr() on...



details:   https://anonhg.NetBSD.org/src/rev/eaff0da55a4e
branches:  trunk
changeset: 780262:eaff0da55a4e
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Jul 18 17:12:39 2012 +0000

description:
>From Kamil Dudka: fix crash of el_insertstr() on incomplete multi-byte

diffstat:

 lib/libedit/chared.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r a015dd3af0f6 -r eaff0da55a4e lib/libedit/chared.c
--- a/lib/libedit/chared.c      Wed Jul 18 16:59:41 2012 +0000
+++ b/lib/libedit/chared.c      Wed Jul 18 17:12:39 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.c,v 1.36 2011/10/23 17:37:55 christos Exp $     */
+/*     $NetBSD: chared.c,v 1.37 2012/07/18 17:12:39 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)chared.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.36 2011/10/23 17:37:55 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.37 2012/07/18 17:12:39 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -612,7 +612,7 @@
 {
        size_t len;
 
-       if ((len = Strlen(s)) == 0)
+       if (s == NULL || (len = Strlen(s)) == 0)
                return -1;
        if (el->el_line.lastchar + len >= el->el_line.limit) {
                if (!ch_enlargebufs(el, len))



Home | Main Index | Thread Index | Old Index