g4klx / NXDNClients

A gateway and a parrot for NXDN.
GNU General Public License v2.0
43 stars 155 forks source link

Fix buffer overflow and -Wreorder warnings #1

Closed phl0 closed 6 years ago

phl0 commented 6 years ago

Compiler messages were:

In file included from /usr/include/string.h:635:0,
                 from /usr/include/c++/5/cstring:42,
                 from NXDNNetwork.cpp:25:
In function ‘void* memcpy(void*, const void*, size_t)’,
    inlined from ‘bool CNXDNNetwork::writeData(const unsigned char*, unsigned int, short unsigned int, short unsigned int, bool, const in_ad
dr&, unsigned int)’ at NXDNNetwork.cpp:74:35:
/usr/include/i386-linux-gnu/bits/string3.h:53:71: warning: call to void* __builtin___memcpy_chk(void*, const void*, unsigned int, unsigned i
nt) will always overflow destination buffer
   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
                                                                       ^

and

Voice.h: In constructor ‘CVoice::CVoice(const string&, const string&, unsigned int)’:
Voice.h:65:47: warning: ‘CVoice::m_positions’ will be initialized after [-Wreorder]
  std::unordered_map<std::string, CPositions*> m_positions;
                                               ^
Voice.h:63:41: warning:   ‘unsigned char* CVoice::m_voiceData’ [-Wreorder]
  unsigned char*                         m_voiceData;
                                         ^
Voice.cpp:47:1: warning:   when initialized here [-Wreorder]
 CVoice::CVoice(const std::string& directory, const std::string& language, unsigned int srcId) :
 ^
g4klx commented 6 years ago

I've included these changes in my next commit (I had some other uncommitted work) so I won't use this pull request. Please keep watching and fixing though.

phl0 commented 6 years ago

Never mind.