[pgpool-general: 6951] Fix-condition-tok-is-always-true
sherlockcpp
sherlockcpp at foxmail.com
Mon Apr 6 17:29:02 JST 2020
Hello,
In pool_passwd.c:391
I found the condition “if (tok)” is is always true, Because previous condition has already checked that.
the code is as follows (the code following dose not seem to be used now, But for security, we'd better fix it)
---------------------------------
383 /* Get backend user */
384 t = getNextToken(t, &tok);
385 if (tok)
386 {
387 /* check if we also have the password */
388 char *pwd;
389
390 t = getNextToken(t, &pwd);
391 if (tok)
392 {
393 pwdMapping->backendUser.password = pwd;
394 pwdMapping->backendUser.userName = tok;
395 pwdMapping->backendUser.passwordType = get_password_type(pwdMapping->backendUser.password);
396 pwdMapping->mappedUser = true;
397 }
398 }
399 break;
---------------------------------
I think the condition that really need to be checked here is ”if (pwd)“.
Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20200406/968b7127/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix-condition-tok-is-always-true.patch
Type: application/octet-stream
Size: 385 bytes
Desc: not available
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20200406/968b7127/attachment.obj>
More information about the pgpool-general
mailing list