diff --git a/plugins/python/pyhelpers.c b/plugins/python/pyhelpers.c index f3a0b67d9..85bd70103 100644 --- a/plugins/python/pyhelpers.c +++ b/plugins/python/pyhelpers.c @@ -205,7 +205,7 @@ py_str_array_from_tuple(PyObject *py_tuple) Py_ssize_t tuple_size = PyTuple_Size(py_tuple); // we need an extra 0 at the end - char **result = calloc(tuple_size + 1, sizeof(char *)); + char **result = calloc((size_t)tuple_size + 1, sizeof(char *)); if (result == NULL) { debug_return_ptr(NULL); } diff --git a/plugins/python/python_convmessage.c b/plugins/python/python_convmessage.c index 7b2aa6d0e..9804961f0 100644 --- a/plugins/python/python_convmessage.c +++ b/plugins/python/python_convmessage.c @@ -137,7 +137,7 @@ sudo_module_ConvMessages_to_c(PyObject *py_tuple, Py_ssize_t *num_msgs, struct s debug_return_int(SUDO_RC_ERROR); } - *msgs = calloc(*num_msgs, sizeof(struct sudo_conv_message)); + *msgs = calloc((size_t)*num_msgs, sizeof(struct sudo_conv_message)); if (*msgs == NULL) { debug_return_int(SUDO_RC_ERROR); } diff --git a/plugins/python/regress/iohelpers.c b/plugins/python/regress/iohelpers.c index d4811004d..47da9e146 100644 --- a/plugins/python/regress/iohelpers.c +++ b/plugins/python/regress/iohelpers.c @@ -149,7 +149,7 @@ str_replaced(const char *source, size_t dest_len, const char *old, const char *n return NULL; while ((pos = strstr(source, old)) != NULL) { - size_t len = snprintf(dest, dest_len, + size_t len = (size_t)snprintf(dest, dest_len, "%.*s%s", (int)(pos - source), source, new); if (len >= dest_len) goto fail; diff --git a/plugins/python/regress/testhelpers.c b/plugins/python/regress/testhelpers.c index 42971bbb6..102d437ff 100644 --- a/plugins/python/regress/testhelpers.c +++ b/plugins/python/regress/testhelpers.c @@ -42,7 +42,7 @@ remove_underline(char *output) size_t len = strspn(cp, "^ \t"); if (len > 0 && cp[len] == '\n') { /* Prune out lines that are "underlining". */ - memmove(cp, cp + len + 1, ep - cp); + memmove(cp, cp + len + 1, (size_t)(ep - cp)); if (*cp == '\0') break; } else { @@ -238,8 +238,10 @@ verify_log_lines(const char *reference_path) line_data += 2; char *line_end = strstr(line_data, " object at "); // this skips checking the pointer hex - if (line_end) - snprintf(line_end, sizeof(line) - (line_end - line), " object>\n"); + if (line_end) { + snprintf(line_end, sizeof(line) - (size_t)(line_end - line), + " object>\n"); + } if (strncmp(line_data, "handle @ /", sizeof("handle @ /") - 1) == 0) { char *start = line_data + sizeof("handle @ ") - 1; diff --git a/plugins/python/sudo_python_module.c b/plugins/python/sudo_python_module.c index ee94101c9..2ef4feabb 100644 --- a/plugins/python/sudo_python_module.c +++ b/plugins/python/sudo_python_module.c @@ -351,7 +351,7 @@ python_sudo_conversation(PyObject *Py_UNUSED(self), PyObject *py_args, PyObject goto cleanup; } - replies = calloc(num_msgs, sizeof(struct sudo_conv_reply)); + replies = calloc((size_t)num_msgs, sizeof(struct sudo_conv_reply)); if (replies == NULL) goto cleanup; py_result = PyTuple_New(num_msgs);