Skip to content

Commit e96f4d3

Browse files
committed
try to avoid linux error
UTCP/src/ftp_c.cpp:2978:12: error: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 10 bytes from a string of length 260 [-Werror=stringop-truncation] 2978 | strncpy(di->mod, m_szBuf, sizeof(di->mod)-1);
1 parent 01c4ad1 commit e96f4d3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

UTCP/src/ftp_c.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,8 @@ void CUT_FTPClient::GetInfoInUNIXFormat( CUT_DIRINFOA * di){
29752975
++ loop;
29762976
}
29772977

2978-
strncpy(di->mod, m_szBuf, sizeof(di->mod)-1);
2978+
strncpy(di->mod, &m_szBuf[0], sizeof(di->mod)-1);
2979+
di->mod[sizeof(di->mod)-1] = '\0';
29792980

29802981
//directory attrib
29812982
if(m_szBuf[0]=='d' || m_szBuf[0] =='D')

0 commit comments

Comments
 (0)