From 8b6eb0985f32158bd85472778d66fc78b6b7f0dc Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 19 Mar 2020 11:28:16 +0100 Subject: [PATCH] one of client warnings fixed --- .../slsDetector/slsDetector.cpp | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 2415e1164..f21813895 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -4110,10 +4110,13 @@ int slsDetector::configureMAC() { //converting IPaddress to hex stringstream ss(arg[0]); char cword[50]=""; - bzero(cword, 50); + memset(cword, 0, sizeof(cword)); string s; while (getline(ss, s, '.')) { - sprintf(cword,"%s%02x",cword,atoi(s.c_str())); + char temp[20]=""; + memset(temp, 0, sizeof(temp)); + sprintf(temp,"%02x",atoi(s.c_str())); + strcat(cword, temp); } bzero(arg[0], 50); strcpy(arg[0],cword); @@ -4126,12 +4129,12 @@ int slsDetector::configureMAC() { //converting MACaddress to hex stringstream ss(arg[1]); char cword[50]=""; - bzero(cword, 50); + memset(cword, 0, sizeof(cword)); string s; while (getline(ss, s, ':')) { - sprintf(cword,"%s%s",cword,s.c_str()); + strcat(cword, s.c_str()); } - bzero(arg[1], 50); + memset(arg[1], 0, sizeof(arg[1])); strcpy(arg[1],cword); #ifdef VERBOSE std::cout<<"receiver mac:"<