diff options
| -rw-r--r-- | src/msgb.c | 5 | ||||
| -rw-r--r-- | src/socket.c | 2 | ||||
| -rw-r--r-- | src/utils.c | 20 | 
3 files changed, 16 insertions, 11 deletions
| @@ -522,10 +522,11 @@ const char *msgb_hexdump(const struct msgb *msg)   */  char *msgb_hexdump_c(const void *ctx, const struct msgb *msg)  { -	char *buf = talloc_size(ctx, msgb_length(msg)*3 + 100); +	size_t buf_len = msgb_length(msg) * 3 + 100; +	char *buf = talloc_size(ctx, buf_len);  	if (!buf)  		return NULL; -	return msgb_hexdump_buf(buf, sizeof(buf), msg); +	return msgb_hexdump_buf(buf, buf_len, msg);  }  /*! Print a string to the end of message buffer. diff --git a/src/socket.c b/src/socket.c index c817e723..7c412b66 100644 --- a/src/socket.c +++ b/src/socket.c @@ -837,7 +837,7 @@ char *osmo_sock_get_name2_c(const void *ctx, int fd)  	char *str = talloc_size(ctx, OSMO_SOCK_NAME_MAXLEN);  	if (!str)  		return NULL; -	osmo_sock_get_name_buf(str, sizeof(str), fd); +	osmo_sock_get_name_buf(str, OSMO_SOCK_NAME_MAXLEN, fd);  	return str;  } diff --git a/src/utils.c b/src/utils.c index 896e9177..b66721e6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -351,10 +351,11 @@ char *osmo_hexdump(const unsigned char *buf, int len)   */  char *osmo_hexdump_c(const void *ctx, const unsigned char *buf, int len)  { -	char *hexd_buff = talloc_size(ctx, len*3 + 1); +	size_t hexd_buff_len = len * 3 + 1; +	char *hexd_buff = talloc_size(ctx, hexd_buff_len);  	if (!hexd_buff)  		return NULL; -	osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, " ", true); +	osmo_hexdump_buf(hexd_buff, hexd_buff_len, buf, len, " ", true);  	return hexd_buff;  } @@ -389,10 +390,11 @@ char *osmo_hexdump_nospc(const unsigned char *buf, int len)   */  char *osmo_hexdump_nospc_c(const void *ctx, const unsigned char *buf, int len)  { -	char *hexd_buff = talloc_size(ctx, len*2 + 1); +	size_t hexd_buff_len = len * 2 + 1; +	char *hexd_buff = talloc_size(ctx, hexd_buff_len);  	if (!hexd_buff)  		return NULL; -	osmo_hexdump_buf(hexd_buff, sizeof(hexd_buff), buf, len, "", true); +	osmo_hexdump_buf(hexd_buff, hexd_buff_len, buf, len, "", true);  	return hexd_buff;  } @@ -908,10 +910,11 @@ const char *osmo_str_tolower(const char *src)   */  char *osmo_str_tolower_c(const void *ctx, const char *src)  { -	char *buf = talloc_size(ctx, strlen(src)+1); +	size_t buf_len = strlen(src) + 1; +	char *buf = talloc_size(ctx, buf_len);  	if (!buf)  		return NULL; -	osmo_str_tolower_buf(buf, sizeof(buf), src); +	osmo_str_tolower_buf(buf, buf_len, src);  	return buf;  } @@ -966,10 +969,11 @@ const char *osmo_str_toupper(const char *src)   */  char *osmo_str_toupper_c(const void *ctx, const char *src)  { -	char *buf = talloc_size(ctx, strlen(src)+1); +	size_t buf_len = strlen(src) + 1; +	char *buf = talloc_size(ctx, buf_len);  	if (!buf)  		return NULL; -	osmo_str_toupper_buf(buf, sizeof(buf), src); +	osmo_str_toupper_buf(buf, buf_len, src);  	return buf;  } | 
