Skip to content

Fix insecure atoi usage#121

Open
slusarz wants to merge 2 commits intodovecot:mainfrom
slusarz:fix-insecure-atoi-usage
Open

Fix insecure atoi usage#121
slusarz wants to merge 2 commits intodovecot:mainfrom
slusarz:fix-insecure-atoi-usage

Conversation

@slusarz
Copy link
Copy Markdown
Contributor

@slusarz slusarz commented May 6, 2026

Convert to Dovecot str_to_uint() instead.

slusarz added 2 commits May 6, 2026 15:35
Replaced insecure atoi usage with str_to_uint() when
parsing IMAP tagged replies.
Comment thread src/imap-client.c
str_to_uint(t_strcut(p+1, ' '), &tag_id) == 0)
cmd = command_lookup(client, tag_id);

if (cmd == NULL)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

don't remove {}

Comment thread src/imap-client.c
command_lookup(client, atoi(t_strcut(p+1, ' '))) : NULL;
if (cmd == NULL) {
if (p != NULL &&
str_to_uint(t_strdup_until(tag, p), &global_id) == 0 &&
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since there's already a different complaint: Don't say atoi() is insecure in commit message. This change is nice enough, but makes practically no difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants