mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-24 14:54:54 +00:00
Fix crash in r2panels config
This commit is contained in:
parent
8afa731a2f
commit
9a1965f73e
@ -3618,6 +3618,8 @@ static void savePanelsLayout(RPanels* panels) {
|
||||
}
|
||||
|
||||
static char *parsePanelsConfig(const char *cfg, int len) {
|
||||
for(len = strlen(cfg); len && cfg[len] != ']'; len--);
|
||||
|
||||
if (!cfg || !*cfg || len < 2 || *cfg != '[') {
|
||||
eprintf ("Not valid config!\n");
|
||||
return NULL;
|
||||
@ -3639,6 +3641,8 @@ static char *parsePanelsConfig(const char *cfg, int len) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
tmp[len] = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@ -3660,10 +3664,10 @@ static int loadSavedPanelsLayout(RCore *core) {
|
||||
panelsConfig = r_file_slurp (configPath, &s);
|
||||
free (configPath);
|
||||
if (!panelsConfig) {
|
||||
free (panelsConfig);
|
||||
return 0;
|
||||
}
|
||||
char *parsedConfig = parsePanelsConfig (panelsConfig, strlen (panelsConfig));
|
||||
|
||||
char *parsedConfig = parsePanelsConfig (panelsConfig, s);
|
||||
free (panelsConfig);
|
||||
if (!parsedConfig) {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user