]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11345: Fixed Werror=stringop-truncation for mod_opus
authorSergey Safarov <s.safarov@gmail.com>
Wed, 12 Dec 2018 05:27:06 +0000 (05:27 +0000)
committerSergey Safarov <s.safarov@gmail.com>
Wed, 12 Dec 2018 21:18:19 +0000 (21:18 +0000)
Fixed Werror=format-truncation on sofia-sip/libsofia-sip-ua/tport

Fixed Werror=format-truncation on mod/endpoints/mod_verto

Fixed unused-but-set-variable in mod_lua

Fixed Werror=format-truncation on libs/sofia-sip/libsofia-sip-ua/tport

Fixed Wunused-variable Wmaybe-uninitialized on mod_soundtouch

Fixed Wliteral-suffix for libs/unimrcp

libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
libs/sofia-sip/libsofia-sip-ua/tport/ws.c
libs/unimrcp/libs/apr-toolkit/include/apt_log.h
libs/unimrcp/platforms/umc/src/umcconsole.cpp
libs/unimrcp/platforms/umc/src/umcscenario.cpp
src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
src/mod/codecs/mod_opus/mod_opus.c
src/mod/endpoints/mod_verto/ws.c
src/mod/languages/mod_lua/mod_lua.cpp

index 8d7beeeeb0deb7d8f4ed1a3c6d37e7b974e31dc4..1c889da5f6b0b618ced4eaa0c39e36435007484c 100644 (file)
@@ -315,7 +315,7 @@ int tport_open_log(tport_master_t *mr, tagi_t *tags)
 
 /** Create log stamp */
 void tport_stamp(tport_t const *self, msg_t *msg,
-                char stamp[128], char const *what,
+                char stamp[512], char const *what,
                 size_t n, char const *via,
                 su_time_t now)
 {
@@ -357,7 +357,7 @@ void tport_stamp(tport_t const *self, msg_t *msg,
 
   su_inet_ntop(su->su_family, SU_ADDR(su), name, sizeof(name));
 
-  snprintf(stamp, 128,
+  snprintf(stamp, 144,
           "%s "MOD_ZU" bytes %s %s/[%s]:%u%s%s at %02u:%02u:%02u.%06lu:\n",
           what, (size_t)n, via, self->tp_name->tpn_proto,
           name, ntohs(su->su_port), label[0] ? label : "", comp,
index ced491d82902204039ef18bb293400929a9ebe15..8d6de2909ba9a43c7c435a819e5237957229820a 100644 (file)
@@ -254,10 +254,10 @@ int ws_handshake(wsh_t *wsh)
        char version[5] = "";
        char proto[256] = "";
        char proto_buf[384] = "";
-       char input[256] = "";
+       char input[512] = "";
        unsigned char output[SHA1_HASH_SIZE] = "";
        char b64[256] = "";
-       char respond[512] = "";
+       char respond[1024] = "";
        ssize_t bytes;
        char *p, *e = 0;
 
index a9ec8d91c62aca27849bb85ca51c7291e20ecef2..9e022c31633853c2170a69e4b20009dfab8edc76 100644 (file)
@@ -58,11 +58,11 @@ APT_BEGIN_EXTERN_C
 /** Format to log string identifiers and resources */
 #define APT_SIDRES_FMT    "<%s@%s>"
 /** Format to log pointers and identifiers */
-#define APT_PTRSID_FMT    APT_PTR_FMT" "APT_SID_FMT
+#define APT_PTRSID_FMT    APT_PTR_FMT" " APT_SID_FMT
 /** Format to log pointers and identifiers */
-#define APT_NAMESID_FMT   "%s "APT_SID_FMT
+#define APT_NAMESID_FMT   "%s " APT_SID_FMT
 /** Format to log names, identifiers and resources */
-#define APT_NAMESIDRES_FMT "%s "APT_SIDRES_FMT
+#define APT_NAMESIDRES_FMT "%s " APT_SIDRES_FMT
 
 /** Priority of log messages ordered from highest priority to lowest (rfc3164) */
 typedef enum {
index 3165854082ea863275fefd530c7d4c05dc412247..a065208a91f0defe4c06cba0ece0589e98508777 100644 (file)
@@ -246,7 +246,7 @@ void UmcConsole::Usage()
 {
        printf(
                "\n"
-               " * "UNI_COPYRIGHT"\n"
+               " * " UNI_COPYRIGHT"\n"
                " *\n"
                UNI_LICENSE"\n"
                "\n"
index 085aa755fb427ce73f78fdc56fd091700c64228a..d9300dcf3c5eb47fd942d482b17752cc6609bc27 100644 (file)
@@ -221,7 +221,7 @@ const char* UmcScenario::LoadFileContent(const char* pFileName, apr_size_t& size
 
        size = (apr_size_t)finfo.size;
        char* pContent = (char*) apr_palloc(pool,size+1);
-       apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%"APR_SIZE_T_FMT" bytes] %s",size,pFilePath);
+       apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%" APR_SIZE_T_FMT" bytes] %s",size,pFilePath);
        if(apr_file_read(pFile,pContent,&size) != APR_SUCCESS) 
        {
                apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Content %s",pFilePath);
index 734a09ba4e78be8c6c3ac27ad93101abc4d6e19a..fc2843440b4221e4de941214a4cbd3be0d1c637a 100644 (file)
@@ -252,7 +252,8 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
        char *argv[6];
        int argc;
        char *lbuf = NULL;
-       int x, n;
+       int x;
+       int n=0;
 
        if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
                if (!zstr(data) && !strcasecmp(data, "stop")) {
@@ -334,7 +335,6 @@ SWITCH_STANDARD_API(soundtouch_api_function)
         char *argv[10] = { 0 };
        char *uuid = NULL;
        char *action = NULL;
-       char *lbuf = NULL;
        int x, n;
 
        if (zstr(cmd)) {
index b06d8fa18894f40b9c09393fb94cb3839693dbbe..1125a27d17f2a90148330308d2bcce8cb007c706 100644 (file)
@@ -207,19 +207,19 @@ static uint32_t switch_opus_encoder_set_audio_bandwidth(OpusEncoder *encoder_obj
 static switch_bool_t switch_opus_show_audio_bandwidth(int audiobandwidth,char *audiobandwidth_str)
 {
        if (audiobandwidth == OPUS_BANDWIDTH_NARROWBAND) {
-               strncpy(audiobandwidth_str, "NARROWBAND",10);
+               strncpy(audiobandwidth_str, "NARROWBAND",11);
                return SWITCH_TRUE;
        } else if (audiobandwidth == OPUS_BANDWIDTH_MEDIUMBAND) {
-               strncpy(audiobandwidth_str, "MEDIUMBAND",10);
+               strncpy(audiobandwidth_str, "MEDIUMBAND",11);
                return SWITCH_TRUE;
        } else if (audiobandwidth == OPUS_BANDWIDTH_WIDEBAND) {
-               strncpy(audiobandwidth_str,"WIDEBAND",8);
+               strncpy(audiobandwidth_str,"WIDEBAND",9);
                return SWITCH_TRUE;
        } else if (audiobandwidth == OPUS_BANDWIDTH_SUPERWIDEBAND) {
-               strncpy(audiobandwidth_str, "SUPERWIDEBAND",13);
+               strncpy(audiobandwidth_str, "SUPERWIDEBAND",14);
                return SWITCH_TRUE;
        } else if (audiobandwidth == OPUS_BANDWIDTH_FULLBAND) {
-               strncpy(audiobandwidth_str, "FULLBAND",8);
+               strncpy(audiobandwidth_str, "FULLBAND",9);
                return SWITCH_TRUE;
        }
        return SWITCH_FALSE;
index d92fd0bcea30cc664daf7238f48a1b2f6090cb48..86c73c18fa6a56330628a4a48ea1b0a5508279be 100644 (file)
@@ -254,10 +254,10 @@ int ws_handshake(wsh_t *wsh)
        char version[5] = "";
        char proto[256] = "";
        char proto_buf[384] = "";
-       char input[256] = "";
+       char input[512] = "";
        unsigned char output[SHA1_HASH_SIZE] = "";
        char b64[256] = "";
-       char respond[512] = "";
+       char respond[1024] = "";
        ssize_t bytes;
        char *p, *e = 0;
 
index 47d14c6d484a556791de0d7b20879845e1fa72e0..63aaf25fc06db362a09e0f7b2de835f78326d66c 100644 (file)
@@ -118,7 +118,6 @@ int docall(lua_State * L, int narg, int nresults, int perror, int fatal)
 static lua_State *lua_init(void)
 {
        lua_State *L = luaL_newstate();
-       int error = 0;
 
        if (L) {
                const char *buff = "os.exit = function() freeswitch.consoleLog(\"err\", \"Surely you jest! exiting is a bad plan....\\n\") end";
@@ -127,7 +126,7 @@ static lua_State *lua_init(void)
                luaopen_freeswitch(L);
                lua_gc(L, LUA_GCRESTART, 0);
                lua_atpanic(L, panic);
-               error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0, 1);
+               luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 0, 0, 1);
        }
        return L;
 }