[svn-commits] rmudgett: trunk r397903 - in /trunk: ./ funcs/ main/ main/stdtime/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Aug 28 18:15:45 CDT 2013
Author: rmudgett
Date: Wed Aug 28 18:15:43 2013
New Revision: 397903
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397903
Log:
Fix some uninitialized buffers for CDR handling valgrind found.
* Made ast_strftime_locale() ensure that the output buffer is initialized.
The std library strftime() returns 0 and does not touch the buffer if it
has an error. However, the function can also return 0 without an error.
........
Merged revisions 397902 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/funcs/func_cdr.c
trunk/main/cdr.c
trunk/main/stdtime/localtime.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Wed Aug 28 18:15:43 2013
@@ -1,1 +1,1 @@
-/branches/12:1-397816,397854,397856,397859,397870,397874,397876,397885,397892,397894,397896,397898,397900
+/branches/12:1-397816,397854,397856,397859,397870,397874,397876,397885,397892,397894,397896,397898,397900,397902
Modified: trunk/funcs/func_cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_cdr.c?view=diff&rev=397903&r1=397902&r2=397903
==============================================================================
--- trunk/funcs/func_cdr.c (original)
+++ trunk/funcs/func_cdr.c Wed Aug 28 18:15:43 2013
@@ -213,6 +213,8 @@
AST_APP_ARG(options);
);
+ buf[0] = '\0';/* Ensure the buffer is initialized. */
+
if (!chan) {
return -1;
}
Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=397903&r1=397902&r2=397903
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Wed Aug 28 18:15:43 2013
@@ -2764,6 +2764,7 @@
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 @@
}
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 @@
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 @@
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);
Modified: trunk/main/stdtime/localtime.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stdtime/localtime.c?view=diff&rev=397903&r1=397902&r2=397903
==============================================================================
--- trunk/main/stdtime/localtime.c (original)
+++ trunk/main/stdtime/localtime.c Wed Aug 28 18:15:43 2013
@@ -2304,6 +2304,7 @@
long fraction;
const char *prevlocale;
+ buf[0] = '\0';/* Ensure the buffer is initialized. */
if (!format) {
return -1;
}
More information about the svn-commits
mailing list