diff options
author | Alex Dowad <alexinbeijing@gmail.com> | 2014-05-01 13:45:32 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-05-01 17:47:27 +0300 |
commit | 618bdff5f21b7b90c40fba93bafa88ceb3e522dc (patch) | |
tree | 04d5bd74aadf9e0c187bd7489eb0a00d870608f2 /src/squark-filter.c | |
parent | b64c621c9de3fa72ff1f1688d8453d99f5cf7352 (diff) | |
download | squark-618bdff5f21b7b90c40fba93bafa88ceb3e522dc.tar.bz2 squark-618bdff5f21b7b90c40fba93bafa88ceb3e522dc.tar.xz |
squark-filter, squark-auth-ip: avoid overflow of login_name buffer
Diffstat (limited to 'src/squark-filter.c')
-rw-r--r-- | src/squark-filter.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/squark-filter.c b/src/squark-filter.c index b938355..827540e 100644 --- a/src/squark-filter.c +++ b/src/squark-filter.c @@ -434,11 +434,13 @@ static void read_input(struct sqdb *db) } else { if (authdb_check_login(token, &entry, username, now, &adbc)) { auth_ok = 1; - username = BLOB_STRLEN(entry.p.login_name); + username = BLOB_CHAR_ARRAY(entry.p.login_name); } else if ((!adbc.require_auth) || (!blob_is_null(username) && blob_cmp(username, dash) != 0)) { auth_ok = 1; authdb_clear_entry(&entry); + if (username.len > sizeof(entry.p.login_name)) + username.len = sizeof(entry.p.login_name); /* avoid buffer overflow */ memcpy(entry.p.login_name, username.ptr, username.len); authdb_commit_login(token, &entry, now, &adbc); } else { |