Fixing a bad case of walking/writing out of allocated space.... the

allocated space was 2048 bytes, but when adding 1024 to the variable
`unix_name' to split the allocated space in half it effectively starts just
OUTSIDE the allocated space. This ought to fix memory corruption bugs when
using UDF.

This is a routine to revisit one day.
This commit is contained in:
reinoud 2006-07-09 13:58:47 +00:00
parent 2be993a357
commit b1b70c855b

View File

@ -1,4 +1,4 @@
/* $NetBSD: udf_subr.c,v 1.10 2006/06/20 03:22:12 christos Exp $ */
/* $NetBSD: udf_subr.c,v 1.11 2006/07/09 13:58:47 reinoud Exp $ */
/*
* Copyright (c) 2006 Reinoud Zandijk
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: udf_subr.c,v 1.10 2006/06/20 03:22:12 christos Exp $");
__RCSID("$NetBSD: udf_subr.c,v 1.11 2006/07/09 13:58:47 reinoud Exp $");
#endif /* not lint */
@ -2100,8 +2100,8 @@ udf_to_unix_name(char *result, char *id, int len, struct charspec *chsp)
uint8_t *outchp;
int ucode_chars, nice_uchars;
raw_name = malloc(2048, M_UDFTEMP, M_WAITOK);
unix_name = raw_name + 1024;
raw_name = malloc(2048 * sizeof(uint16_t), M_UDFTEMP, M_WAITOK);
unix_name = raw_name + 1024; /* split space in half */
assert(sizeof(char) == sizeof(uint8_t));
outchp = (uint8_t *) result;
if ((chsp->type == 0) && (strcmp((char*) chsp->inf, "OSTA Compressed Unicode") == 0)) {