[sr-dev] git:master:65159728: carrierroute: do not test return for strcpy() and strcat()

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 6 09:09:45 CEST 2020


Module: kamailio
Branch: master
Commit: 65159728a4425f45559de55fd5549731e717d74e
URL: https://github.com/kamailio/kamailio/commit/65159728a4425f45559de55fd5549731e717d74e

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-07-06T09:03:32+02:00

carrierroute: do not test return for strcpy() and strcat()

- they return the dst or src parameter, resulting in code analyzer
reporting

---

Modified: src/modules/carrierroute/cr_config.c

---

Diff:  https://github.com/kamailio/kamailio/commit/65159728a4425f45559de55fd5549731e717d74e.diff
Patch: https://github.com/kamailio/kamailio/commit/65159728a4425f45559de55fd5549731e717d74e.patch

---

diff --git a/src/modules/carrierroute/cr_config.c b/src/modules/carrierroute/cr_config.c
index 920ae4142c..e65ad0789e 100644
--- a/src/modules/carrierroute/cr_config.c
+++ b/src/modules/carrierroute/cr_config.c
@@ -121,14 +121,8 @@ static int backup_config(void) {
 		PKG_MEM_ERROR;
 		return -1;
 	}
-	if(!strcpy(backup_file, config_file)){
-		LM_ERR("can't copy filename\n");
-		goto errout;
-	}
-	if(!strcat(backup_file, ".bak")){
-		LM_ERR("can't attach suffix\n");
-		goto errout;
-	}
+	strcpy(backup_file, config_file);
+	strcat(backup_file, ".bak");
 	/* open source file */
 	if ((from = fopen(config_file, "rb"))==NULL) {
 		LM_ERR("Cannot open source file.\n");




More information about the sr-dev mailing list