Skip to content

Commit

Permalink
Copy terminating nul bytes into strings in TAuthenticate
Browse files Browse the repository at this point in the history
Both pt and ru are 5 characters long, so this is safe.
  • Loading branch information
amadio committed Dec 6, 2018
1 parent 407c55d commit 860b4b8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/auth/src/TAuthenticate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -842,19 +842,19 @@ void TAuthenticate::SetEnvironment()
} else {
if (!strncasecmp(gEnv->GetValue(usrPromptDef,""),"no",2) ||
!strncmp(gEnv->GetValue(usrPromptDef,""),"0",1))
strncpy(pt,"0",1);
strncpy(pt,"0",2);
else
strncpy(pt,"1",1);
strncpy(pt,"1",2);
}
TString usrReUseDef = TString(GetAuthMethod(fSecurity)) + ".ReUse";
if ((ptr = strstr(fDetails, "ru:")) != 0) {
sscanf(ptr + 3, "%4s %8191s", ru, usdef);
} else {
if (!strncasecmp(gEnv->GetValue(usrReUseDef,""),"no",2) ||
!strncmp(gEnv->GetValue(usrReUseDef,""),"0",1))
strncpy(ru,"0",1);
strncpy(ru,"0",2);
else
strncpy(ru,"1",1);
strncpy(ru,"1",2);
}
TString usrValidDef = TString(GetAuthMethod(fSecurity)) + ".Valid";
TString hours(gEnv->GetValue(usrValidDef,"24:00"));
Expand Down

0 comments on commit 860b4b8

Please sign in to comment.