Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear password without memset #182

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/cibuild
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export DISTRIBUTION_SLUG
# and chmod this directory on the host so that the permissions are persisted when the
# the directory is mounted in the containers. Since the mysql container runs as a non-root
# user, we need to ensure that the directory is writable by all users.
mkdir tmp/mysql-certs
mkdir -p tmp/mysql-certs
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this change because it was erring when I run this script locally multiple times.

chmod 777 tmp/mysql-certs

docker compose rm --stop --force --volumes
Expand Down
7 changes: 6 additions & 1 deletion src/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,12 @@ int trilogy_auth_switch_send(trilogy_conn_t *conn, const trilogy_handshake_t *ha
void trilogy_auth_clear_password(trilogy_conn_t *conn)
{
if (conn->socket->opts.password) {
memset(conn->socket->opts.password, 0, conn->socket->opts.password_len);
volatile char *password_ptr = (volatile char*)(conn->socket->opts.password);
while (conn->socket->opts.password_len--) {
*password_ptr++ = 0;
}
free(conn->socket->opts.password);
conn->socket->opts.password = NULL;
}
}

Expand Down
Loading