Skip to content

Commit

Permalink
Lets not introduce an buffer overun trying to fix an other.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent e47fa3e commit f5fd229
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tools/bsmtp.c
Expand Up @@ -413,7 +413,7 @@ int main (int argc, char *argv[])
exit(1);
}
strncpy(my_hostname, ai->ai_canonname, sizeof(my_hostname) - 1);
my_hostname[sizeof(my_hostname)] = '\0';
my_hostname[sizeof(my_hostname) - 1] = '\0';
freeaddrinfo(ai);
#else
if ((hp = gethostbyname(my_hostname)) == NULL) {
Expand All @@ -422,7 +422,7 @@ int main (int argc, char *argv[])
exit(1);
}
strncpy(my_hostname, hp->h_name, sizeof(my_hostname) - 1);
my_hostname[sizeof(my_hostname)] = '\0';
my_hostname[sizeof(my_hostname) - 1] = '\0';
#endif
Dmsg1(20, "My hostname is: %s\n", my_hostname);

Expand Down

0 comments on commit f5fd229

Please sign in to comment.