client: strip whitespace when read GUI RPC passwd file

This commit is contained in:
David Anderson 2020-10-30 19:16:33 -07:00
parent 86d0e9fbd1
commit 1cca463736
1 changed files with 3 additions and 9 deletions

View File

@ -478,16 +478,10 @@ int read_gui_rpc_password(char* buf, string& msg) {
return ERR_FOPEN;
#endif
}
char* p = fgets(buf, 256, f);
if (p) {
// trim CR
//
int n = (int)strlen(buf);
if (n && buf[n-1]=='\n') {
buf[n-1] = 0;
}
buf[0] = 0;
if (fgets(buf, 256, f)) {
strip_whitespace(buf);
}
fclose(f);
return 0;
}