Skip to content

Commit

Permalink
acc: don't multiply seconds with 1000 for time mode 2
Browse files Browse the repository at this point in the history
- it can go out of range for 32bit arch

(cherry picked from commit 0c6653b)
(cherry picked from commit d7ddbd5)
  • Loading branch information
miconda committed Jun 29, 2016
1 parent f525e3e commit 4778ca5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/acc/acc.c
Expand Up @@ -232,6 +232,7 @@ int acc_log_request( struct sip_msg *rq)
int o;
int i;
struct tm *t;
double dtime;

/* get default values */
m = core2strar( rq, val_arr, int_arr, type_arr);
Expand Down Expand Up @@ -290,12 +291,11 @@ int acc_log_request( struct sip_msg *rq)
acc_time_exten.s, (unsigned int)acc_env.tv.tv_usec,
log_msg);
} else if(acc_time_mode==2) {
dtime = (double)acc_env.tv.tv_usec;
dtime = (dtime / 1000000) + (double)acc_env.tv.tv_sec;
LM_GEN2(log_facility, log_level, "%.*stimestamp=%lu;%s=%.3f%s",
acc_env.text.len, acc_env.text.s,(unsigned long)acc_env.ts,
acc_time_attr.s,
(((double)(acc_env.tv.tv_sec * 1000)
+ (acc_env.tv.tv_usec / 1000)) / 1000),
log_msg);
acc_time_attr.s, dtime, log_msg);
} else if(acc_time_mode==3 || acc_time_mode==4) {
if(acc_time_mode==3) {
t = localtime(&acc_env.ts);
Expand Down

0 comments on commit 4778ca5

Please sign in to comment.