mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-29 17:33:08 +00:00
Fix boundary check on swift demangling
- found by ASAN
This commit is contained in:
parent
d60f9c7684
commit
ef03be2675
@ -175,6 +175,7 @@ R_API char *r_bin_demangle_swift(const char *s, int syscmd) {
|
||||
const char *attr2 = NULL;
|
||||
const char *q, *p = s;
|
||||
const char *q_end = p + strlen (p);
|
||||
const char *q_start = p;
|
||||
|
||||
if (strchr (s, '\'') || strchr (s, ' ')) {
|
||||
return NULL;
|
||||
@ -351,7 +352,7 @@ R_API char *r_bin_demangle_swift(const char *s, int syscmd) {
|
||||
} else {
|
||||
/* parse function parameters here */
|
||||
// type len value/
|
||||
for (i = 0; q && q < q_end; i++) {
|
||||
for (i = 0; q && q < q_end && q >= q_start; i++) {
|
||||
if (*q == 'f') {
|
||||
q++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user