Remove compiler warnings

net/ftpworker.cpp: In member function 'bool CFTPWorker::_ZN10CFTPWorker4PortEPKc.part.0(const char*)':
net/ftpworker.cpp:466:9: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 512 equals destination size [-Wstringop-truncation]
  466 |  strncpy(Buffer, pArgs, sizeof(Buffer));
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ftpworker.cpp: In member function 'const TDirectoryListEntry* CFTPWorker::BuildDirectoryList(size_t&) const':
net/ftpworker.cpp:365:11: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 6 equals destination size [-Wstringop-truncation]
  365 |    strncpy(VolumeName, VolumeNames[i], sizeof(VolumeName));
      |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../Synth_Dexed/src/dexed.cpp: In member function 'void Dexed::setName(char*)':
../Synth_Dexed/src/dexed.cpp:1699:10: warning: 'char* strncpy(char*, const char*, size_t)' output may be truncated copying 10 bytes from a string of length 155 [-Wstringop-truncation]
 1699 |   strncpy(name, (char*)&data[DEXED_VOICE_OFFSET + DEXED_NAME], 10);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
network
probonopd 4 days ago
parent 2fbb9d238f
commit b59af14514
  1. 4
      src/net/ftpworker.cpp

@ -362,7 +362,7 @@ const TDirectoryListEntry* CFTPWorker::BuildDirectoryList(size_t& nOutEntries) c
for (size_t i = 0; i < nVolumes; ++i)
{
char VolumeName[6];
strncpy(VolumeName, VolumeNames[i], sizeof(VolumeName));
strncpy(VolumeName, VolumeNames[i], sizeof(VolumeName) - 1);
strcat(VolumeName, ":");
// Returns FR_
@ -463,7 +463,7 @@ bool CFTPWorker::Port(const char* pArgs)
return false;
char Buffer[TextBufferSize];
strncpy(Buffer, pArgs, sizeof(Buffer));
strncpy(Buffer, pArgs, sizeof(Buffer) - 1);
if (m_pDataSocket != nullptr)
{

Loading…
Cancel
Save