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
This commit is contained in:
parent
8eb779a3cf
commit
4722697645
@ -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,7 +393,8 @@ 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);
|
||||
|
||||
@ -401,20 +402,24 @@ static void set_rtpfile(void)
|
||||
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 */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user