summaryrefslogtreecommitdiffstats
path: root/sys/fs/udf
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2002-08-20 04:46:04 +0000
committerscottl <scottl@FreeBSD.org>2002-08-20 04:46:04 +0000
commitacc240c9d382201426bfbc4d44f0bd077086b74a (patch)
tree8b64dd7f0bc0f8e6217ba9323110e9a34967d6a3 /sys/fs/udf
parent0ce1476f39e78d51b003a8b1eac43d38dd781ad6 (diff)
downloadFreeBSD-src-acc240c9d382201426bfbc4d44f0bd077086b74a.zip
FreeBSD-src-acc240c9d382201426bfbc4d44f0bd077086b74a.tar.gz
Don't abuse the stack when translating names.
Diffstat (limited to 'sys/fs/udf')
-rw-r--r--sys/fs/udf/udf_vnops.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c
index 0db8f9f..4fa1632 100644
--- a/sys/fs/udf/udf_vnops.c
+++ b/sys/fs/udf/udf_vnops.c
@@ -454,10 +454,6 @@ udf_transname(char *cs0string, char *destname, int len)
/* allocate a buffer big enough to hold an 8->16 bit expansion */
transname = uma_zalloc(udf_zone_trans, M_WAITOK);
- if (transname == NULL) {
- printf("udf: out of memory?\n");
- return 0;
- }
if ((unilen = udf_UncompressUnicode(len, cs0string, transname)) == -1) {
printf("udf: Unicode translation failed\n");
@@ -490,16 +486,22 @@ udf_transname(char *cs0string, char *destname, int len)
static int
udf_cmpname(char *cs0string, char *cmpname, int cs0len, int cmplen)
{
- char transname[MAXNAMLEN+1]; /* XXX stack */
+ char *transname;
+ int error = 0;
- if ((cs0len = udf_transname(cs0string, &transname[0], cs0len)) == 0)
- return -1;
+ /* This is overkill, but not worth creating a new zone */
+ transname = uma_zalloc(udf_zone_trans, M_WAITOK);
+
+ cs0len = udf_transname(cs0string, transname, cs0len);
/* Easy check. If they aren't the same length, they aren't equal */
- if (cs0len != cmplen)
- return -1;
+ if ((cs0len == 0) || (cs0len != cmplen))
+ error = -1;
+ else
+ error = bcmp(transname, cmpname, cmplen);
- return (bcmp(transname, cmpname, cmplen));
+ uma_zfree(udf_zone_trans, transname);
+ return (error);
}
struct udf_uiodir {
OpenPOWER on IntegriCloud