diff options
author | Benny Prijono <bennylp@teluu.com> | 2013-10-08 09:08:13 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2013-10-08 09:08:13 +0000 |
commit | 7369d96f8361c523a7ae4753391a9a7336a89fb8 (patch) | |
tree | 64afc15371dfb0cafe15648537d33d4ad0c4c38a /pjsip/src/pjsua-lib/pjsua_dump.c | |
parent | 476648f068a362857304aca7b383f700a304d59e (diff) |
Re #1703: fixing general bugs. First installment: correct handling of snprintf return value
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4613 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_dump.c')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_dump.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_dump.c b/pjsip/src/pjsua-lib/pjsua_dump.c index 2f8ef73c..8fbe8c49 100644 --- a/pjsip/src/pjsua-lib/pjsua_dump.c +++ b/pjsip/src/pjsua-lib/pjsua_dump.c @@ -128,7 +128,7 @@ static unsigned dump_media_stat(const char *indent, "" ); - if (len < 1 || len > end-p) { + if (len < 1 || len >= end-p) { *p = '\0'; return (unsigned)(p-buf); } @@ -186,7 +186,7 @@ static unsigned dump_media_stat(const char *indent, pj_math_stat_get_stddev(&stat->tx.jitter) / 1000.0 ); - if (len < 1 || len > end-p) { + if (len < 1 || len >= end-p) { *p = '\0'; return (unsigned)(p-buf); } @@ -201,7 +201,7 @@ static unsigned dump_media_stat(const char *indent, stat->rtt.last / 1000.0, pj_math_stat_get_stddev(&stat->rtt) / 1000.0 ); - if (len < 1 || len > end-p) { + if (len < 1 || len >= end-p) { *p = '\0'; return (unsigned)(p-buf); } @@ -259,7 +259,7 @@ static void dump_media_session(const char *indent, len = pj_ansi_snprintf(p, end-p, "%s #%d %s deactivated\n", indent, i, media_type_str); - if (len < 1 || len > end-p) { + if (len < 1 || len >= end-p) { *p = '\0'; return; } @@ -363,7 +363,7 @@ static void dump_media_session(const char *indent, codec_info, dir_str, rem_addr); - if (len < 1 || len > end-p) { + if (len < 1 || len >= end-p) { *p = '\0'; return; } @@ -470,7 +470,7 @@ static void dump_media_session(const char *indent, sprintf(s, "%d", v) # define VALIDATE_PRINT_BUF() \ - if (len < 1 || len > end-p) { *p = '\0'; return; } \ + if (len < 1 || len >= end-p) { *p = '\0'; return; } \ p += len; *p++ = '\n'; *p = '\0' |