]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11993 [mod_http_cache][mod_smpp] fix gcc errors when building on rpi4 buster ...
authorDavid Grant <david@infomind.com>
Tue, 13 Aug 2019 18:44:26 +0000 (13:44 -0500)
committerDavid Grant <david@infomind.com>
Sun, 25 Aug 2019 03:48:59 +0000 (22:48 -0500)
FS-11993 [mod_http_cache][mod_smpp] fix gcc errors when building on rpi4 buster (strncpy to snprintf)

src/mod/applications/mod_http_cache/mod_http_cache.c
src/mod/event_handlers/mod_smpp/mod_smpp_gateway.c

index e3f8d064930f720a571e43b8282bdcaeb7010caf..7144e54da7eb51eede651322f6fc1d35a41002cd 100644 (file)
@@ -273,7 +273,7 @@ static void parse_domain(const char *url, char *domain_buf, int domain_buf_len)
        if (!*start) {
                return;
        }
-       strncpy(domain_buf, start, domain_buf_len);
+       snprintf(domain_buf, domain_buf_len, "%s", start);
        end = strchr(domain_buf, '/');
        if (end) {
                *end = '\0';
@@ -985,7 +985,7 @@ static char *cached_url_filename_create(url_cache_t *cache, const char *url, cha
        /* filename is constructed from UUID and is stored in cache dir (first 2 characters of UUID) */
        switch_uuid_get(&uuid);
        switch_uuid_format(uuid_str, &uuid);
-       strncpy(uuid_dir, uuid_str, 2);
+       snprintf(uuid_dir, sizeof(uuid_dir), "%.2s", uuid_str);
        dirname = switch_mprintf("%s%s%s", cache->location, SWITCH_PATH_SEPARATOR, uuid_dir);
 
        /* create sub-directory if it doesn't exist */
index ed965860398d09ca654d0cfe67862a40d66cc44c..4be9790083160341420161cb112c0a0236c126f0 100644 (file)
@@ -112,15 +112,15 @@ switch_status_t mod_smpp_gateway_authenticate(mod_smpp_gateway_t *gateway) {
        strncpy( (char *)req_b->address_range, gateway->host, sizeof(req_b->address_range));
 
        if ( gateway->system_id ) {
-               strncpy((char *)req_b->system_id, gateway->system_id, sizeof(req_b->system_id));
+               snprintf((char *)req_b->system_id, sizeof(req_b->system_id), "%s",  gateway->system_id);
        }
 
        if ( gateway->password ) {
-               strncpy((char *)req_b->password, gateway->password, sizeof(req_b->password));
+               snprintf((char *)req_b->password, sizeof(req_b->password), "%s", gateway->password);
        }
 
        if ( gateway->system_type ) {
-               strncpy((char *)req_b->system_type, gateway->system_type, sizeof(req_b->system_type));
+               snprintf((char *)req_b->system_type, sizeof(req_b->system_type), "%s", gateway->system_type);
        }
 
     req_b->interface_version = SMPP_VERSION;