Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit add +1 to strlcpy's (Patrick Welche)
details: https://anonhg.NetBSD.org/src/rev/1940a1202c28
branches: trunk
changeset: 464507:1940a1202c28
user: christos <christos%NetBSD.org@localhost>
date: Wed Oct 09 14:31:07 2019 +0000
description:
add +1 to strlcpy's (Patrick Welche)
diffstat:
lib/libedit/filecomplete.c | 10 +++++-----
lib/libedit/readline.c | 12 ++++++------
2 files changed, 11 insertions(+), 11 deletions(-)
diffs (99 lines):
diff -r c57632f6df8b -r 1940a1202c28 lib/libedit/filecomplete.c
--- a/lib/libedit/filecomplete.c Wed Oct 09 14:20:47 2019 +0000
+++ b/lib/libedit/filecomplete.c Wed Oct 09 14:31:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $ */
+/* $NetBSD: filecomplete.c,v 1.61 2019/10/09 14:31:07 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.61 2019/10/09 14:31:07 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -86,7 +86,7 @@
temp = el_calloc(len, sizeof(*temp));
if (temp == NULL)
return NULL;
- (void)strlcpy(temp, txt + 1, len - 2);
+ (void)strlcpy(temp, txt + 1, len - 1);
}
if (temp[0] == 0) {
#ifdef HAVE_GETPW_R_POSIX
@@ -353,7 +353,7 @@
return NULL;
}
dirname = nptr;
- (void)strlcpy(dirname, text, len);
+ (void)strlcpy(dirname, text, len + 1);
} else {
el_free(filename);
if (*text == 0)
@@ -507,7 +507,7 @@
el_free(match_list);
return NULL;
}
- (void)strlcpy(retstr, match_list[1], max_equal);
+ (void)strlcpy(retstr, match_list[1], max_equal + 1);
match_list[0] = retstr;
/* add NULL as last pointer to the array */
diff -r c57632f6df8b -r 1940a1202c28 lib/libedit/readline.c
--- a/lib/libedit/readline.c Wed Oct 09 14:20:47 2019 +0000
+++ b/lib/libedit/readline.c Wed Oct 09 14:31:07 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.158 2019/10/08 19:17:57 christos Exp $ */
+/* $NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.158 2019/10/08 19:17:57 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.159 2019/10/09 14:31:07 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -607,7 +607,7 @@
else {
if ((pat = el_calloc(len + 1, sizeof(*pat))) == NULL)
return NULL;
- (void)strlcpy(pat, cmd + begin, len);
+ (void)strlcpy(pat, cmd + begin, len + 1);
}
if (history(h, &ev, H_CURR) != 0) {
@@ -701,7 +701,7 @@
if ((aptr = el_calloc(offs + 1, sizeof(*aptr)))
== NULL)
return -1;
- strlcpy(aptr, command, offs);
+ (void)strlcpy(aptr, command, offs + 1);
idx = 1;
} else {
int qchar;
@@ -958,7 +958,7 @@
} \
result = nresult; \
} \
- (void)strlcpy(&result[idx], what, len); \
+ (void)strlcpy(&result[idx], what, len + 1); \
idx += len; \
}
@@ -1147,7 +1147,7 @@
el_free(result);
return NULL;
}
- (void)strlcpy(temp, &str[start], len);
+ (void)strlcpy(temp, &str[start], len + 1);
result[idx++] = temp;
result[idx] = NULL;
if (str[i])
Home |
Main Index |
Thread Index |
Old Index