# HG changeset patch # User andrew # Date 1316650406 -3600 # Node ID 13b32b29aab8446f736c554a8098b7eb2cf1c113 # Parent 2a3693537ec86ba64cc53e11bc31207abba859f8 Dynamically allocate buffer using string length to avoid buffer overflow. diff -r 2a3693537ec8 -r 13b32b29aab8 src/solaris/native/java/lang/java_props_md.c --- a/src/solaris/native/java/lang/java_props_md.c Thu Sep 22 01:12:18 2011 +0100 +++ b/src/solaris/native/java/lang/java_props_md.c Thu Sep 22 01:13:26 2011 +0100 @@ -124,7 +124,7 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script, char ** std_country, char ** std_variant, char ** std_encoding) { - char temp[64]; + char *temp; char *language = NULL, *country = NULL, *variant = NULL, *encoding = NULL; char *p, encoding_variant[64]; @@ -168,6 +168,7 @@ * , , and are optional. */ + temp = (char*) malloc(strlen(lc)+1); strcpy(temp, lc); /* Parse the language, country, encoding, and variant from the @@ -306,6 +307,10 @@ #endif } + + /* Free temp */ + free(temp); + return 1; }