Commit f4a87317 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Nul terminate

Might be a better idea to implement strlcpy()
parent 1cea7efd
...@@ -458,14 +458,18 @@ static void Win32AddConnection( access_t *p_access, char *psz_path, ...@@ -458,14 +458,18 @@ static void Win32AddConnection( access_t *p_access, char *psz_path,
/* Find out server and share names */ /* Find out server and share names */
strncpy( psz_server, psz_path, sizeof( psz_server ) ); strncpy( psz_server, psz_path, sizeof( psz_server ) );
psz_server[sizeof (psz_server) - 1] = '\0';
psz_share[0] = 0; psz_share[0] = 0;
psz_parser = strchr( psz_path, '/' ); psz_parser = strchr( psz_path, '/' );
if( psz_parser ) if( psz_parser )
{ {
char *psz_parser2 = strchr( ++psz_parser, '/' ); char *psz_parser2 = strchr( ++psz_parser, '/' );
if( psz_parser2 ) if( psz_parser2 )
{
strncpy( psz_share, psz_parser, sizeof( psz_share ) ); strncpy( psz_share, psz_parser, sizeof( psz_share ) );
} psz_parse[sizeof (psz_parse) - 1] = '\0';
}
}
sprintf( psz_remote, "\\\\%s\\%s", psz_server, psz_share ); sprintf( psz_remote, "\\\\%s\\%s", psz_server, psz_share );
net_resource.lpRemoteName = psz_remote; net_resource.lpRemoteName = psz_remote;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment