Skip to content
Permalink
Browse files

Fix compiler warnings

* Changed type from int to size_t to avoid warning
  warning: comparison between signed and unsigned integer expressions
* Fixed string truncation warning
  • Loading branch information
misi committed Mar 3, 2020
1 parent 8eb779a commit 4722697645cf033de8cf4f34e4214af750746365
Showing with 13 additions and 6 deletions.
  1. +2 −0 ChangeLog
  2. +9 −4 src/apps/common/ns_turn_utils.c
  3. +2 −2 src/client/ns_turn_msg.c
@@ -49,6 +49,8 @@ Version 4.5.1.2 'dan Eider':
- merge PR #475 Update README.docker (by raksonibs)
- merge PR #471 Fix a memory leak when an SHATYPE isn't supported (by bobsayshilol)
- merge PR #488 Fix typos about INSTALL filenames (by raccoonback)
- fix compiler warning comparison between signed and unsigned integer expressions
- fix compiler warning string truncation

02/03/2019 Oleg Moskalenko <mom040267@gmail.com> Mihály Mészáros <misi@majd.eu>
Version 4.5.1.1 'dan Eider':
@@ -393,28 +393,33 @@ static void set_rtpfile(void)
else
snprintf(logtail, FILE_STR_LEN, "turn_%d_", (int)getpid());

snprintf(logbase, FILE_STR_LEN, "/var/log/turnserver/%s", logtail);
if (snprintf(logbase, FILE_STR_LEN, "/var/log/turnserver/%s", logtail)<0)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "String truncation occured.\n");

set_log_file_name(logbase, logf);

_rtpfile = fopen(logf, "a");
if(_rtpfile)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "log file opened: %s\n", logf);
else {
snprintf(logbase, FILE_STR_LEN, "/var/log/%s", logtail);
if (snprintf(logbase, FILE_STR_LEN, "/var/log/%s", logtail)<0)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "String truncation occured.\n");

set_log_file_name(logbase, logf);
_rtpfile = fopen(logf, "a");
if(_rtpfile)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "log file opened: %s\n", logf);
else {
snprintf(logbase, FILE_STR_LEN, "/var/tmp/%s", logtail);
if (snprintf(logbase, FILE_STR_LEN, "/var/tmp/%s", logtail)<0)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "String truncation occured.\n");

set_log_file_name(logbase, logf);
_rtpfile = fopen(logf, "a");
if(_rtpfile)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "log file opened: %s\n", logf);
else {
snprintf(logbase, FILE_STR_LEN, "/tmp/%s", logtail);
if (snprintf(logbase, FILE_STR_LEN, "/tmp/%s", logtail)<0)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "String truncation occured.\n");
set_log_file_name(logbase, logf);
_rtpfile = fopen(logf, "a");
if(_rtpfile)
@@ -386,7 +386,7 @@ int stun_get_command_message_len_str(const uint8_t* buf, size_t len)
return -1;

/* Validate the size the buffer claims to be */
int bufLen = (int) (nswap16(((const uint16_t*)(buf))[1]) + STUN_HEADER_LENGTH);
size_t bufLen = (size_t) (nswap16(((const uint16_t*)(buf))[1]) + STUN_HEADER_LENGTH);
if (bufLen > len) {
return -1;
}
@@ -1386,7 +1386,7 @@ static stun_attr_ref stun_attr_check_valid(stun_attr_ref attr, size_t remaining)

if(remaining >= 4) {
/* Read the size of the attribute */
int attrlen = stun_attr_get_len(attr);
size_t attrlen = stun_attr_get_len(attr);
remaining -= 4;

/* Round to boundary */

0 comments on commit 4722697

Please sign in to comment.
You can’t perform that action at this time.