Skip to content

Commit

Permalink
Dereference query pointers before checking to see if they're empty
Browse files Browse the repository at this point in the history
This effectively did a check to see if the pointer was NULL, exactly what we did in the LHS of the and operator.

This fixes the following messages of cppcheck:

[src/modules/rlm_sql/rlm_sql.c:638]: (warning) Char literal compared with pointer 'inst.config.authorize_group_check_query'. Did you intend to dereference it?
[src/modules/rlm_sql/rlm_sql.c:675]: (warning) Char literal compared with pointer 'inst.config.authorize_group_reply_query'. Did you intend to dereference it?
  • Loading branch information
herwinw authored and arr2036 committed Oct 18, 2014
1 parent 999c495 commit 457ece7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/rlm_sql/rlm_sql.c
Expand Up @@ -635,7 +635,7 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t *inst, REQUEST *request, rlm
goto finish;
}

if (inst->config->authorize_group_check_query && (inst->config->authorize_group_check_query != '\0')) {
if (inst->config->authorize_group_check_query && (*inst->config->authorize_group_check_query != '\0')) {
/*
* Expand the group query
*/
Expand Down Expand Up @@ -672,7 +672,7 @@ static rlm_rcode_t rlm_sql_process_groups(rlm_sql_t *inst, REQUEST *request, rlm
check_tmp = NULL;
}

if (inst->config->authorize_group_reply_query && (inst->config->authorize_group_reply_query != '\0')) {
if (inst->config->authorize_group_reply_query && (*inst->config->authorize_group_reply_query != '\0')) {
/*
* Now get the reply pairs since the paircompare matched
*/
Expand Down

0 comments on commit 457ece7

Please sign in to comment.