Changeset 2e1e0990567db4bd21567f830a8dfd4f027ddca3

Show
Ignore:
Timestamp:
29/04/06 15:38:50 (3 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1146317930 +0000
git-parent:

[30cc7ccac0a7f593b1f4c8247f231fcd8167618b]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1146317930 +0000
Message:

Use strncpy() rather than strncat() when the destination is empty

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/smb.c

    r4f15591 r2e1e099  
    458458 
    459459    /* Find out server and share names */ 
    460     psz_server[0] = psz_share[0] = 0; 
     460    strncpy( psz_server, psz_path, sizeof( psz_server ) ); 
     461    psz_share[0] = 0; 
    461462    psz_parser = strchr( psz_path, '/' ); 
    462463    if( psz_parser ) 
    463464    { 
    464         char *psz_parser2; 
    465         strncat( psz_server, psz_path, psz_parser - psz_path ); 
    466         psz_parser2 = strchr( psz_parser+1, '/' ); 
     465        char *psz_parser2 = strchr( ++psz_parser, '/' ); 
    467466        if( psz_parser2 ) 
    468             strncat( psz_share, psz_parser+1, psz_parser2 - psz_parser -1 ); 
    469     } 
    470     else strncat( psz_server, psz_path, MAX_PATH ); 
     467            strncpy( psz_share, psz_parser, sizeof( psz_share ) ); 
     468    } 
    471469 
    472470    sprintf( psz_remote, "\\\\%s\\%s", psz_server, psz_share );