summaryrefslogtreecommitdiffstats
path: root/src/squark-auth-ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/squark-auth-ip.c')
-rw-r--r--src/squark-auth-ip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/squark-auth-ip.c b/src/squark-auth-ip.c
index 94c450f..74e0583 100644
--- a/src/squark-auth-ip.c
+++ b/src/squark-auth-ip.c
@@ -60,7 +60,7 @@ static void handle_line(blob_t line)
blob_push(&b, id);
if (auth_ok) {
blob_push(&b, BLOB_STR(" OK user="));
- blob_push(&b, BLOB_STRLEN(entry.p.login_name));
+ blob_push(&b, BLOB_CHAR_ARRAY(entry.p.login_name));
blob_push(&b, BLOB_PTR_LEN("\n", 1));
} else {
blob_push(&b, BLOB_STR(" ERR\n"));
@@ -210,6 +210,8 @@ int main(int argc, char **argv)
return 2;
}
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);
break;