mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Fix infinite loop in r_str_replace ##util
* Add check for empty `key`, since `r_str_replace` does not check for empty `key` and will loop indefinitely. * Add test case for this (occurs with highlight grep)
This commit is contained in:
parent
c5545c3d27
commit
1f123e41e4
@ -962,6 +962,9 @@ R_API char* r_str_replace(char *str, const char *key, const char *val, int g) {
|
||||
r_str_replace_char (str, *key, *val);
|
||||
return str;
|
||||
}
|
||||
if (klen == 0) {
|
||||
return str;
|
||||
}
|
||||
if (klen == vlen && !strcmp (key, val)) {
|
||||
return str;
|
||||
}
|
||||
|
@ -438,3 +438,14 @@ Hello World
|
||||
4e2420
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=highlight grep with empty string
|
||||
ARGS=-escr.highlight.grep=true
|
||||
TIMEOUT=2
|
||||
CMDS=<<EOF
|
||||
i~[0]:0
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
fd
|
||||
EOF
|
||||
RUN
|
||||
|
Loading…
Reference in New Issue
Block a user