mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-07 13:51:16 +00:00
Fix #2566 - Avoid negative realloc in microsoft demangler
This commit is contained in:
parent
48869fc5c7
commit
8b15b1ddee
@ -123,10 +123,13 @@ int copy_string(STypeCodeStr *type_code_str, char *str_for_copy, unsigned int co
|
||||
return 0;
|
||||
}
|
||||
if (free_space > str_for_copy_len) {
|
||||
type_code_str->type_str_len =
|
||||
((type_code_str->type_str_len + str_for_copy_len) << 1) + 1;
|
||||
char *type_str = (char *) realloc (
|
||||
type_code_str->type_str, type_code_str->type_str_len);
|
||||
int newlen = ((type_code_str->type_str_len + str_for_copy_len) << 1) + 1;
|
||||
if (newlen < 1) {
|
||||
R_FREE (type_code_str->type_str);
|
||||
goto copy_string_err;
|
||||
}
|
||||
type_code_str->type_str_len = newlen;
|
||||
char *type_str = (char *) realloc (type_code_str->type_str, newlen);
|
||||
if (!type_str) {
|
||||
R_FREE (type_code_str->type_str);
|
||||
goto copy_string_err;
|
||||
|
Loading…
Reference in New Issue
Block a user