Showing
2 changed files
with
4 additions
and
2 deletions
... | ... | @@ -94,7 +94,8 @@ TR_socketInit(TR_Socket this, TR_socketAction_fptr action) |
94 | 94 | |
95 | 95 | //fcntl(this->handle, F_SETFL, flags | O_NONBLOCK); |
96 | 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 | 100 | this->fin_state = TR_FIN_NO; |
100 | 101 | ... | ... |
Please
register
or
login
to post a comment