diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-05 23:02:13 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2022-01-05 23:03:54 +0100 |
commit | 6062c0d19bc201cbeb61b8875598cdd7a14a5ae0 (patch) | |
tree | 0dbe9b5d8b0f97c3a7e23d28d7a6a9735abfce42 /libbb | |
parent | db5546ca101846f18294a43b39883bc4ff53613a (diff) | |
download | busybox-w32-6062c0d19bc201cbeb61b8875598cdd7a14a5ae0.tar.gz busybox-w32-6062c0d19bc201cbeb61b8875598cdd7a14a5ae0.tar.bz2 busybox-w32-6062c0d19bc201cbeb61b8875598cdd7a14a5ae0.zip |
libbb: change xstrndup, xmemdup to take size_t as size parameter
Also, remove entirely usually-disabled paranoia check (was also using
wrong config option to enable itself).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xfuncs_printf.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index d29acebcd..fc630d176 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c | |||
@@ -91,13 +91,10 @@ char* FAST_FUNC xstrdup(const char *s) | |||
91 | 91 | ||
92 | // Die if we can't allocate n+1 bytes (space for the null terminator) and copy | 92 | // Die if we can't allocate n+1 bytes (space for the null terminator) and copy |
93 | // the (possibly truncated to length n) string into it. | 93 | // the (possibly truncated to length n) string into it. |
94 | char* FAST_FUNC xstrndup(const char *s, int n) | 94 | char* FAST_FUNC xstrndup(const char *s, size_t n) |
95 | { | 95 | { |
96 | char *t; | 96 | char *t; |
97 | 97 | ||
98 | if (ENABLE_DEBUG && s == NULL) | ||
99 | bb_simple_error_msg_and_die("xstrndup bug"); | ||
100 | |||
101 | t = strndup(s, n); | 98 | t = strndup(s, n); |
102 | 99 | ||
103 | if (t == NULL) | 100 | if (t == NULL) |
@@ -106,7 +103,7 @@ char* FAST_FUNC xstrndup(const char *s, int n) | |||
106 | return t; | 103 | return t; |
107 | } | 104 | } |
108 | 105 | ||
109 | void* FAST_FUNC xmemdup(const void *s, int n) | 106 | void* FAST_FUNC xmemdup(const void *s, size_t n) |
110 | { | 107 | { |
111 | return memcpy(xmalloc(n), s, n); | 108 | return memcpy(xmalloc(n), s, n); |
112 | } | 109 | } |