Skip to content

Commit 6056b94

Browse files
committed
Silence a few PVS Studio false positives
1 parent 0f53474 commit 6056b94

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

logsrvd/iolog_writer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ strlist_copy(const InfoMessage__StringList *strlist)
112112
* Free a NULL-terminated string vector.
113113
*/
114114
static void
115-
strvec_free(char *vec[])
115+
strvec_free(char **vec)
116116
{
117117
if (vec != NULL) {
118118
char **vp;

plugins/sudoers/match_digest.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ digest_matches(int fd, const char *path, const char *runchroot,
8181
file_digest = sudo_filedigest(fd, path, digest->digest_type,
8282
&digest_len);
8383
if (lseek(fd, (off_t)0, SEEK_SET) == -1) {
84-
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|SUDO_DEBUG_LINENO,
84+
sudo_debug_printf(
85+
SUDO_DEBUG_ERROR|SUDO_DEBUG_ERRNO|SUDO_DEBUG_LINENO,
8586
"unable to rewind digest fd");
8687
}
8788
digest_type = digest->digest_type;
@@ -92,7 +93,8 @@ digest_matches(int fd, const char *path, const char *runchroot,
9293
}
9394

9495
/* Convert the command digest from ascii to binary. */
95-
if ((sudoers_digest = malloc(digest_len)) == NULL) {
96+
sudoers_digest = malloc(digest_len); // -V614
97+
if (sudoers_digest == NULL) {
9698
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
9799
goto done;
98100
}
@@ -107,7 +109,8 @@ digest_matches(int fd, const char *path, const char *runchroot,
107109
}
108110
} else {
109111
/* Convert base64 to binary. */
110-
size_t len = base64_decode(digest->digest_str, sudoers_digest, digest_len);
112+
size_t len = base64_decode(digest->digest_str, sudoers_digest,
113+
digest_len);
111114
if (len == (size_t)-1)
112115
goto bad_format;
113116
if (len != digest_len) {

0 commit comments

Comments
 (0)