Showing
2 changed files
with
4 additions
and
2 deletions
@@ -53,7 +53,8 @@ socketCtor(void * _this, va_list * params) | @@ -53,7 +53,8 @@ socketCtor(void * _this, va_list * params) | ||
53 | this->fin_state = TR_FIN_RDWR; | 53 | this->fin_state = TR_FIN_RDWR; |
54 | 54 | ||
55 | if (host) { | 55 | if (host) { |
56 | - strncpy(this->host, host, TR_MAX_HOST); | 56 | + this->host[TR_MAX_HOST-1] = 0; |
57 | + strncpy(this->host, host, TR_MAX_HOST-1); | ||
57 | } | 58 | } |
58 | 59 | ||
59 | return 0; | 60 | return 0; |
@@ -94,7 +94,8 @@ TR_socketInit(TR_Socket this, TR_socketAction_fptr action) | @@ -94,7 +94,8 @@ TR_socketInit(TR_Socket this, TR_socketAction_fptr action) | ||
94 | 94 | ||
95 | //fcntl(this->handle, F_SETFL, flags | O_NONBLOCK); | 95 | //fcntl(this->handle, F_SETFL, flags | O_NONBLOCK); |
96 | if (current_info->ai_canonname) { | 96 | if (current_info->ai_canonname) { |
97 | - strncpy(this->cname, current_info->ai_canonname, TR_MAX_CNAME); | 97 | + this->cname[TR_MAX_CNAME-1] = 0; |
98 | + strncpy(this->cname, current_info->ai_canonname, TR_MAX_CNAME-1); | ||
98 | } | 99 | } |
99 | this->fin_state = TR_FIN_NO; | 100 | this->fin_state = TR_FIN_NO; |
100 | 101 |
Please
register
or
login
to post a comment