mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-27 04:06:21 +00:00
inp_readline() Correct slashguard feature
Protect against invalid reads by checking the length.
This commit is contained in:
@@ -197,10 +197,12 @@ inp_readline(void)
|
|||||||
|
|
||||||
if (inp_line) {
|
if (inp_line) {
|
||||||
if (!get_password && prefs_get_boolean(PREF_SLASH_GUARD)) {
|
if (!get_password && prefs_get_boolean(PREF_SLASH_GUARD)) {
|
||||||
char *res = (char*) memchr (inp_line+1, '/', 3);
|
if (strlen(inp_line) > 1) {
|
||||||
if (res) {
|
char *res = (char*) memchr (inp_line+1, '/', 3);
|
||||||
cons_show("Your text contains a slash in the first 4 characters");
|
if (res) {
|
||||||
return NULL;
|
cons_show("Your text contains a slash in the first 4 characters");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strdup(inp_line);
|
return strdup(inp_line);
|
||||||
|
|||||||
Reference in New Issue
Block a user