The size of portstr is too small to print an integer and we should print
a short anyway.
This fixes building with GCC 7.1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12930
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Aug 11 18:08:04 CEST 2017 on sn-devel-144
char *hostname, size_t hostlen)
{
const char *proto = "";
- char portstr[7] = "";
+ char portstr[7] = {0};
if(host->proto == KRB5_KRBHST_TCP)
proto = "tcp/";
else if(host->proto == KRB5_KRBHST_HTTP)
proto = "http://";
if(host->port != host->def_port)
- snprintf(portstr, sizeof(portstr), ":%d", host->port);
+ snprintf(portstr, sizeof(portstr), ":%hd", host->port);
snprintf(hostname, hostlen, "%s%s%s", proto, host->hostname, portstr);
return 0;
}