#include <vlc/vlc.h>
#include <stddef.h> /* size_t */
-#include <string.h> /* strncpy(), strlen(), memcpy(), memset(), strchr() */
+#include <string.h> /* strlen(), memcpy(), memset(), strchr() */
#include <stdlib.h> /* malloc(), free(), strtoul() */
#include <errno.h>
if (hent != NULL)
{
- strncpy (host, hent->h_name, hostlen);
- host[hostlen - 1] = '\0';
+ strlcpy (host, hent->h_name, hostlen);
/*
* only keep first part of hostname
}
if (!solved)
- {
/* inet_ntoa() can't fail */
- strncpy (host, inet_ntoa (addr->sin_addr), hostlen);
- host[hostlen - 1] = '\0';
- }
+ strlcpy (host, inet_ntoa (addr->sin_addr), hostlen);
}
if (serv != NULL)
? "udp" : "tcp");
if (sent != NULL)
{
- strncpy (serv, sent->s_name, servlen);
- serv[servlen - 1] = 0;
+ strlcpy (serv, sent->s_name, servlen);
solved = 1;
}
}
}
else
{
- strncpy( psz_buf, node, NI_MAXHOST );
- psz_buf[NI_MAXHOST - 1] = '\0';
+ strlcpy( psz_buf, node, NI_MAXHOST );
psz_node = psz_buf;
{
char *ptr;
- strncpy( psz_uribuf, p_session->psz_uri + 1, sizeof( psz_uribuf ) );
- psz_uribuf[sizeof( psz_uribuf ) - 1] = '\0';
+ strlcpy( psz_uribuf, p_session->psz_uri + 1, sizeof( psz_uribuf ) );
ptr = strchr( psz_uribuf, '%' );
if( ptr != NULL)
*ptr = '\0';