From fbc6fff6e83ed3ea05bf4770f5a5e09ea1c26744 Mon Sep 17 00:00:00 2001
From: Guilherme Amadio <amadio@cern.ch>
Date: Fri, 7 Dec 2018 09:54:18 +0100
Subject: [PATCH] Use strdup() to copy string in THostAuth

---
 net/auth/src/THostAuth.cxx | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/auth/src/THostAuth.cxx b/net/auth/src/THostAuth.cxx
index e85da2e9582..0b364b212d4 100644
--- a/net/auth/src/THostAuth.cxx
+++ b/net/auth/src/THostAuth.cxx
@@ -196,9 +196,7 @@ THostAuth::THostAuth(const char *asstring) : TObject()
    fServer = -1;
 
    TString strtmp(asstring);
-   char *tmp = new char[strlen(asstring)+1];
-   strncpy(tmp,asstring,strlen(asstring));
-   tmp[strlen(asstring)] = 0;
+   char *tmp = strdup(asstring);
 
    fHost = TString((const char *)strtok(tmp," "));
    strtmp.ReplaceAll(fHost,"");
@@ -213,7 +211,7 @@ THostAuth::THostAuth(const char *asstring) : TObject()
    strtmp.ReplaceAll(fNmet,"");
    fNmet.Remove(0,fNmet.Index(":")+1);
 
-   delete[] tmp;
+   free(tmp);
 
    fNumMethods = atoi(fNmet.Data());
    Int_t i = 0;
-- 
GitLab