aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/iconv
diff options
context:
space:
mode:
authorEric van Gyzen <vangyzen@FreeBSD.org>2016-05-14 00:35:35 +0000
committerEric van Gyzen <vangyzen@FreeBSD.org>2016-05-14 00:35:35 +0000
commit079171874c9bf263b69e3af10784ad2bcd1fe699 (patch)
tree8da7769cb4aa77d1f5f61bc6f72d54df2b731aad /lib/libc/iconv
parent39a997283f48db9c7eb11d513600f5dd32474ad7 (diff)
downloadsrc-079171874c9bf263b69e3af10784ad2bcd1fe699.tar.gz
src-079171874c9bf263b69e3af10784ad2bcd1fe699.zip
Notes
Diffstat (limited to 'lib/libc/iconv')
-rw-r--r--lib/libc/iconv/bsd_iconv.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c
index e9ff688887c9..ca0b706d5dc5 100644
--- a/lib/libc/iconv/bsd_iconv.c
+++ b/lib/libc/iconv/bsd_iconv.c
@@ -267,8 +267,9 @@ __bsd_iconvctl(iconv_t cd, int request, void *argument)
struct _citrus_iconv *cv;
struct iconv_hooks *hooks;
const char *convname;
- char src[PATH_MAX], *dst;
+ char *dst;
int *i;
+ size_t srclen;
cv = (struct _citrus_iconv *)(void *)cd;
hooks = (struct iconv_hooks *)argument;
@@ -283,12 +284,9 @@ __bsd_iconvctl(iconv_t cd, int request, void *argument)
case ICONV_TRIVIALP:
convname = cv->cv_shared->ci_convname;
dst = strchr(convname, '/');
-
- strlcpy(src, convname, dst - convname + 1);
+ srclen = dst - convname;
dst++;
- if ((convname == NULL) || (src == NULL) || (dst == NULL))
- return (-1);
- *i = strcmp(src, dst) == 0 ? 1 : 0;
+ *i = (srclen == strlen(dst)) && !memcmp(convname, dst, srclen);
return (0);
case ICONV_GET_TRANSLITERATE:
*i = 1;