Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
dovecot23.16062
0004-lib-smtp-smtp-syntax-Do-not-allow-NULL-ret...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-lib-smtp-smtp-syntax-Do-not-allow-NULL-return-parame.patch of Package dovecot23.16062
From 874817b169d19a4ae51d80ad5798a396bfe90136 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Tue, 24 Mar 2020 21:14:34 +0100 Subject: [PATCH 04/16] lib-smtp: smtp-syntax - Do not allow NULL return parameters for smtp_ehlo_line_parse(). --- src/lib-smtp/smtp-syntax.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/src/lib-smtp/smtp-syntax.c b/src/lib-smtp/smtp-syntax.c index 0b0a91ce07..5cca6c40fd 100644 --- a/src/lib-smtp/smtp-syntax.c +++ b/src/lib-smtp/smtp-syntax.c @@ -249,12 +249,10 @@ static int smtp_parse_ehlo_line(struct smtp_parser *parser, (i_isalnum(*parser->cur) || *parser->cur == '-')) parser->cur++; - if (key_r != NULL) - *key_r = p_strdup_until(parser->pool, pbegin, parser->cur); + *key_r = p_strdup_until(parser->pool, pbegin, parser->cur); if (parser->cur >= parser->end) { - if (params_r != NULL) - *params_r = p_new(parser->pool, const char *, 1); + *params_r = p_new(parser->pool, const char *, 1); return 1; } if (*parser->cur != ' ') { @@ -264,18 +262,16 @@ static int smtp_parse_ehlo_line(struct smtp_parser *parser, parser->cur++; pbegin = parser->cur; - if (params_r != NULL) - p_array_init(¶ms, parser->pool, 32); + p_array_init(¶ms, parser->pool, 32); while (parser->cur < parser->end) { if (*parser->cur == ' ') { if (parser->cur+1 >= parser->end || *(parser->cur+1) == ' ') { parser->error = "Missing EHLO parameter after ' '"; return -1; } - if (params_r != NULL) { - param = p_strdup_until(parser->pool, pbegin, parser->cur); - array_push_back(¶ms, ¶m); - } + param = p_strdup_until(parser->pool, pbegin, + parser->cur); + array_push_back(¶ms, ¶m); pbegin = parser->cur + 1; } else if (!smtp_char_is_ehlo_param(*parser->cur)) { parser->error = "Unexpected character in EHLO parameter"; @@ -284,12 +280,10 @@ static int smtp_parse_ehlo_line(struct smtp_parser *parser, parser->cur++; } - if (params_r != NULL) { - param = p_strdup_until(parser->pool, pbegin, parser->cur); - array_push_back(¶ms, ¶m); - array_append_zero(¶ms); - *params_r = array_front(¶ms); - } + param = p_strdup_until(parser->pool, pbegin, parser->cur); + array_push_back(¶ms, ¶m); + array_append_zero(¶ms); + *params_r = array_front(¶ms); return 1; } @@ -297,19 +291,20 @@ int smtp_ehlo_line_parse(const char *ehlo_line, const char **key_r, const char *const **params_r, const char **error_r) { struct smtp_parser parser; - int ret; + + *key_r = NULL; + *params_r = NULL; + *error_r = NULL; if (ehlo_line == NULL || *ehlo_line == '\0') { - if (error_r != NULL) - *error_r = "Parameter is empty"; + *error_r = "Parameter is empty"; return -1; } smtp_parser_init(&parser, pool_datastack_create(), ehlo_line); - if ((ret=smtp_parse_ehlo_line(&parser, key_r, params_r)) <= 0) { - if (error_r != NULL) - *error_r = parser.error; + if (smtp_parse_ehlo_line(&parser, key_r, params_r) <= 0) { + *error_r = parser.error; return -1; } return 1; -- 2.11.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor