diff --git a/mk/linux/coverity-scan.sh b/mk/linux/coverity-scan.sh index 4f7cc1793..18de3b8a6 100755 --- a/mk/linux/coverity-scan.sh +++ b/mk/linux/coverity-scan.sh @@ -65,16 +65,21 @@ FILENAME=$(echo "${PROJECT}" | tr '/' '_')_${DESCRIPTION} export PATH="${PATH}:${COVERITY_ANALYSIS_ROOT}/bin" +sudo /sbin/sysctl vsyscall=emulate + # cleanup old build files cd $CURRENTDIR rm -rf build ./build-mg.sh -m 1 # Build using Coverity Scan build tool +echo "About to use cov-build to analyse code..." cd build/ +# cov-build --dir ${BUILDTOOL} make -j ${NUMCORES} cov-build --dir ${BUILDTOOL} make -j ${NUMCORES} # Create archive to upload to coverity +echo "About to send analyzed code to coverity website..." tar czf ${FILENAME}.tar.gz ${BUILDTOOL}/ ls -la ${FILENAME}.tar.gz # exit 1 diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index e0b1c9a88..6140cdc4b 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -2349,6 +2349,7 @@ unsigned int NetworkMessageSynchNetworkGameData::getPackedSizeHeader() { static unsigned int result = 0; if(result == 0) { Data packedData; + packedData.messageType=0; unsigned char *buf = new unsigned char[sizeof(packedData)*3]; result = pack(buf, getPackedMessageFormatHeader(), packedData.messageType, diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 45112c330..7d30e5c32 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -2188,12 +2188,15 @@ void BroadCastClientSocketThread::execute() { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); try { - char buff[10024]=""; // Buffers the data to be broadcasted. + char buff[10025]=""; // Buffers the data to be broadcasted. // Keep getting packets forever. for( time_t elapsed = time(NULL); difftime((long int)time(NULL),elapsed) <= 5; ) { alen = sizeof(struct sockaddr); int nb=0;// The number of bytes read. bool gotData = (nb = recvfrom(bcfd, buff, 10024, 0, (struct sockaddr *) &bcSender, &alen)) > 0; + if(nb >= 0) { + buff[nb]=0; + } //printf("Broadcasting client nb = %d buff [%s] gotData = %d\n",nb,buff,gotData); diff --git a/source/shared_lib/sources/platform/sdl/thread.cpp b/source/shared_lib/sources/platform/sdl/thread.cpp index f69353597..c40db480c 100644 --- a/source/shared_lib/sources/platform/sdl/thread.cpp +++ b/source/shared_lib/sources/platform/sdl/thread.cpp @@ -103,7 +103,7 @@ public: BaseThread *base_thread = dynamic_cast(thread); if(base_thread != NULL && (base_thread->getRunningStatus() == true || base_thread->getExecutingTask() == true)) { - if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a")); + if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,base_thread->getUniqueID().c_str()); base_thread->signalQuit(); sleep(10);