Blame SOURCES/sblim-wbemcli-1.6.3-covscan-fixes.patch

8e04bf
diff -up sblim-wbemcli-1.6.3/CimCurl.cpp.orig sblim-wbemcli-1.6.3/CimCurl.cpp
8e04bf
--- sblim-wbemcli-1.6.3/CimCurl.cpp.orig	2019-08-27 14:18:53.329846123 +0200
8e04bf
+++ sblim-wbemcli-1.6.3/CimCurl.cpp	2019-08-27 14:18:53.332846130 +0200
8e04bf
@@ -369,6 +369,7 @@ void CimomCurl::setClientCertificates(co
8e04bf
    } else if (cacert) {
8e04bf
      FILE *fp;
8e04bf
      if ((fp = fopen(cacert, "r"))) {
8e04bf
+       fclose(fp);
8e04bf
        if ((rv=curl_easy_setopt(mHandle,CURLOPT_SSL_VERIFYPEER,1))) {
8e04bf
          cerr << getErrorMessage(rv) << endl;
8e04bf
          throw HttpException("Could not enable peer verification.");
8e04bf
@@ -377,7 +378,6 @@ void CimomCurl::setClientCertificates(co
8e04bf
          cerr << getErrorMessage(rv) << endl;
8e04bf
          throw HttpException("Could not load CA certificate.");
8e04bf
        }
8e04bf
-       fclose(fp);
8e04bf
      } else {
8e04bf
        throw HttpException(
8e04bf
            string("Could not open CA certificate file: ") + string(cacert)
8e04bf
diff -up sblim-wbemcli-1.6.3/CimXml.cpp.orig sblim-wbemcli-1.6.3/CimXml.cpp
8e04bf
--- sblim-wbemcli-1.6.3/CimXml.cpp.orig	2014-10-13 18:05:30.000000000 +0200
8e04bf
+++ sblim-wbemcli-1.6.3/CimXml.cpp	2019-08-27 14:32:20.068589450 +0200
8e04bf
@@ -159,7 +159,7 @@ int XmlBuffer::skipElement(const char *t
8e04bf
       cerr<<"--- XmlBuffer::skipElement(\""<
8e04bf
 #endif
8e04bf
    char eTag[256]="</";
8e04bf
-   strcat(eTag,t);
8e04bf
+   strncat(eTag,t,252);
8e04bf
    strcat(eTag,">");
8e04bf
    char *e=strstr(cur,eTag);
8e04bf
    if (e) {
8e04bf
@@ -451,7 +451,7 @@ AVPs::AVPs(char *s, PropertyArray &prop)
8e04bf
 
8e04bf
 AVPs::AVPs(char *s, ParameterArray &param)
8e04bf
 {
8e04bf
-   char *n, *t, *u, *v, *w;
8e04bf
+   char *n, *t, *u, *v;
8e04bf
    int i,k,j,l;
8e04bf
    bool name = false;
8e04bf
    bool addAValue = false;
8e04bf
@@ -856,8 +856,6 @@ IMethodresponseXml::IMethodresponseXml(X
8e04bf
 	   if (irv->getReturnData() == NULL) {
8e04bf
 	       /* OpenWBEM support */
8e04bf
 	       throw NoReturnValue();
8e04bf
-	       delete irv;
8e04bf
-	       irv=NULL;
8e04bf
 	   }
8e04bf
            if (xb.endTag("IMETHODRESPONSE")) return;
8e04bf
            else throw ParseException("Expecting </IMETHODRESPONSE> tag(2)");
8e04bf
@@ -877,8 +875,6 @@ IMethodresponseXml::IMethodresponseXml(X
8e04bf
 	}
8e04bf
 */	else if (xb.endTag("IMETHODRESPONSE")) {
8e04bf
            throw NoReturnValue();
8e04bf
-           irv=NULL;
8e04bf
-           return;
8e04bf
         }
8e04bf
 /*        else throw ParseException("Expecting </IMETHODRESPONSE> tag(1)");
8e04bf
 	}
8e04bf
@@ -934,8 +930,6 @@ MethodresponseXml::MethodresponseXml(Xml
8e04bf
 	}
8e04bf
 */	else if (xb.endTag("METHODRESPONSE")) {
8e04bf
            throw NoReturnValue();
8e04bf
-           rvl=NULL;
8e04bf
-           return;
8e04bf
         }
8e04bf
 /*        else throw ParseException("Expecting </METHODRESPONSE> tag(1)");
8e04bf
 	}
8e04bf
@@ -2950,7 +2944,7 @@ char *strndup(char *f, int n) {
8e04bf
 
8e04bf
 URL::URL(const char *U)
8e04bf
 {
8e04bf
-   int pint,indir=0;
8e04bf
+   int indir=0;
8e04bf
    char *p,*q,*phelp,*np,*last,*un,*b,*h,*z;
8e04bf
    char *origu, *u;
8e04bf
    u = origu = strdup(U);
8e04bf
@@ -3061,7 +3055,7 @@ URL::URL(const char *U)
8e04bf
      zone_id = -1;
8e04bf
    }
8e04bf
 
8e04bf
-   pint=strtol(port.c_str(),&np,10);
8e04bf
+   (void) strtol(port.c_str(),&np,10);
8e04bf
    if (*np) throw URLException("Invalid port number");
8e04bf
 
8e04bf
    if (!phelp || strlen(phelp+1) == 0) {
8e04bf
@@ -3168,9 +3162,11 @@ int URL::getNetDeviceNum(string devName)
8e04bf
 
8e04bf
   while (2 == fscanf(fp, scnfmt.c_str(), &dev_num, dev_name)) {
8e04bf
     if (strcmp(devName.c_str(), dev_name) == 0) {  /* match */
8e04bf
+      fclose(fp);
8e04bf
       return dev_num;
8e04bf
     }
8e04bf
   }
8e04bf
+  fclose(fp);
8e04bf
   return -1;  // zone id not found in interfaces table
8e04bf
 #endif
8e04bf
 }