diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 9c785112ac73ac9d57f629504bebd9d5461b8226..6d9fb19a1435d4f462316cc7432a5a968c5938a4 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -213,6 +213,8 @@ static int cdr_read(struct ast_channel *chan, const char *cmd, char *parse,
 		AST_APP_ARG(options);
 	);
 
+	buf[0] = '\0';/* Ensure the buffer is initialized. */
+
 	if (!chan) {
 		return -1;
 	}
diff --git a/main/cdr.c b/main/cdr.c
index d0e52e7339a5af0a7f243e8752533bb2c75c0b42..53336c85e895b5827fc8aeb43d16fac453b455e3 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -2764,6 +2764,7 @@ static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufs
 	if (fmt == NULL) {	/* raw mode */
 		snprintf(buf, bufsize, "%ld.%06ld", (long)when.tv_sec, (long)when.tv_usec);
 	} else {
+		buf[0] = '\0';/* Ensure the buffer is initialized. */
 		if (when.tv_sec) {
 			struct ast_tm tm;
 
@@ -3083,8 +3084,6 @@ int ast_cdr_serialize_variables(const char *channel_name, struct ast_str **buf,
 		}
 
 		for (i = 0; cdr_readonly_vars[i]; i++) {
-			/* null out the workspace, because the cdr_get_tv() won't write anything if time is NULL, so you get old vals */
-			workspace[0] = 0;
 			if (cdr_object_format_property(it_cdr, cdr_readonly_vars[i], workspace, sizeof(workspace))) {
 				/* Unhandled read-only CDR variable. */
 				ast_assert(0);
@@ -3638,7 +3637,7 @@ static void cli_show_channels(struct ast_cli_args *a)
 	struct ao2_iterator it_cdrs;
 	struct cdr_object *cdr;
 	char start_time_buffer[64];
-	char answer_time_buffer[64] = "\0";
+	char answer_time_buffer[64];
 	char end_time_buffer[64];
 
 #define TITLE_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n"
@@ -3702,8 +3701,8 @@ static void cli_show_channel(struct ast_cli_args *a)
 	struct cdr_object *it_cdr;
 	char clid[64];
 	char start_time_buffer[64];
-	char answer_time_buffer[64] = "\0";
-	char end_time_buffer[64] = "\0";
+	char answer_time_buffer[64];
+	char end_time_buffer[64];
 	const char *channel_name = a->argv[3];
 	RAII_VAR(struct cdr_object *, cdr, NULL, ao2_cleanup);
 
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c
index f7b4bd0050186d3c3784fa38d5846bc909603291..5ca43b81833d951c36f586d81f598d947f374425 100644
--- a/main/stdtime/localtime.c
+++ b/main/stdtime/localtime.c
@@ -2304,6 +2304,7 @@ int ast_strftime_locale(char *buf, size_t len, const char *tmp, const struct ast
 	long fraction;
 	const char *prevlocale;
 
+	buf[0] = '\0';/* Ensure the buffer is initialized. */
 	if (!format) {
 		return -1;
 	}