]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Annotate issues Coverity see that we have decided to ignore. (#4553)
authorJames Jones <jejones3141@gmail.com>
Wed, 22 Jun 2022 21:12:01 +0000 (16:12 -0500)
committerGitHub <noreply@github.com>
Wed, 22 Jun 2022 21:12:01 +0000 (16:12 -0500)
This change deals with the following CIDs:
1503889150390115039081503916150393615040241504280,
1504282150389415038991504013

Most of these are sbuff/dbuff operations that can only fail if
the buffers can't be reallocated or have reached their specified
maximum size.

In 1503899, we know, but Coverity doesn't, that no log_keyword
passed to _make_vlog() will overrun the fixed-size buffer it uses.

1503894 is what Coverity thinks is a copy/paste error that clearly
makes sense as written.

src/lib/tls/log.c
src/lib/util/log.c
src/modules/rlm_smtp/rlm_smtp.c

index 5d8f58b8599c80694cb78405bf208b26bac20a31..e744696d2221db59b1a92d8d51fe421c67d6e4d0 100644 (file)
@@ -591,6 +591,7 @@ static int tls_log_request_bio_write_cb(BIO *bio, char const *in, int len)
         *      to aggregate it, then look for new line chars
         *      as an indication we need to print the line.
         */
+       /* coverity[checked_return] */
        fr_sbuff_in_bstrncpy(&lb->sbuff, in, len);
 
        /*
@@ -674,6 +675,7 @@ static int tls_log_global_bio_write_cb(BIO *bio, char const *in, int len)
         *      to aggregate it, then look for new line chars
         *      as an indication we need to print the line.
         */
+       /* coverity[checked_return] */
        fr_sbuff_in_bstrncpy(&lb->sbuff, in, len);
 
        /*
index c5ebd30428f56ecf0a0f60a1d2e48f4e52bdc811..f5fdf76824196fd8f92c85508039199d7c350580 100644 (file)
@@ -672,7 +672,9 @@ void fr_vlog_perror(fr_log_t const *log, fr_log_type_t type, char const *file, i
                        fr_sbuff_in_vsprintf(&sbuff, fmt, aq);
                        va_end(aq);
 
+                       /* coverity[checked_return] */
                        fr_sbuff_in_strcpy(&sbuff, ": ");
+                       /* coverity[checked_return] */
                        fr_sbuff_in_strcpy(&sbuff, error);      /* may not be talloced with const */
                        error = fr_sbuff_start(&sbuff);
                }
@@ -698,6 +700,7 @@ void fr_vlog_perror(fr_log_t const *log, fr_log_type_t type, char const *file, i
 
        fr_sbuff_set_to_start(&sbuff);
        if (f_rules->subsq_prefix) {
+               /* coverity[checked_return] */
                fr_sbuff_in_strcpy(&sbuff, f_rules->subsq_prefix);
                fr_sbuff_marker(&prefix_m, &sbuff);
        }
@@ -708,6 +711,7 @@ void fr_vlog_perror(fr_log_t const *log, fr_log_type_t type, char const *file, i
        while ((error = fr_strerror_pop())) {
                if (f_rules->subsq_prefix) {
                        fr_sbuff_set(&sbuff, &prefix_m);
+                       /* coverity[checked_return] */
                        fr_sbuff_in_strcpy(&sbuff, error);      /* may not be talloced with const */
                        error = fr_sbuff_start(&sbuff);
                }
index 7ad24cee0ff3f3574b9e3c0b06c11238e8a14ea0..7e5fcd7fe61e3c2828af2c4553163bbdd5374e8f 100644 (file)
@@ -381,6 +381,7 @@ static int str_to_attachments(fr_mail_ctx_t *uctx, curl_mime *mime, char const *
        }
 
        /* Copy the filename into the buffer */
+       /* coverity[checked_return] */
        fr_sbuff_in_bstrncpy(path_buffer, str, len);
 
        /* Add the file attachment as a mime encoded part */
@@ -485,6 +486,7 @@ static int generate_from_header(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, struc
        (void) fr_sbuff_in_strcpy(&sbuff, from);
 
        /* Copy the envelope address as the FROM: source */
+       /* coverity[checked_return] */
        fr_sbuff_in_bstrncpy(&sbuff, inst->envelope_address, strlen(inst->envelope_address));
        *out = curl_slist_append(*out, sbuff.buff);
 
@@ -567,6 +569,7 @@ static int header_source(rlm_smtp_thread_t *t, fr_mail_ctx_t *uctx, rlm_smtp_t c
                }
 
                /* Format the conf item to be a valid SMTP header */
+               /* coverity[checked_return] */
                fr_sbuff_in_bstrncpy(&conf_buffer, conf_map->lhs->name, conf_map->lhs->len);
                fr_sbuff_in_strcpy(&conf_buffer, ": ");
                fr_sbuff_in_bstrncpy(&conf_buffer, expanded_rhs, strlen(expanded_rhs));