mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
inp_readline() Correct slashguard feature
Protect against invalid reads by checking the length.
This commit is contained in:
parent
f27bd92731
commit
813fd637a1
@ -197,10 +197,12 @@ inp_readline(void)
|
||||
|
||||
if (inp_line) {
|
||||
if (!get_password && prefs_get_boolean(PREF_SLASH_GUARD)) {
|
||||
char *res = (char*) memchr (inp_line+1, '/', 3);
|
||||
if (res) {
|
||||
cons_show("Your text contains a slash in the first 4 characters");
|
||||
return NULL;
|
||||
if (strlen(inp_line) > 1) {
|
||||
char *res = (char*) memchr (inp_line+1, '/', 3);
|
||||
if (res) {
|
||||
cons_show("Your text contains a slash in the first 4 characters");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return strdup(inp_line);
|
||||
|
Loading…
Reference in New Issue
Block a user