[asterisk-bugs] [JIRA] (ASTERISK-27868) several null pointer dereference (detected by cppcheck)

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Mon May 21 08:18:56 CDT 2018


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27868?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=243476#comment-243476 ] 

Richard Mudgett commented on ASTERISK-27868:
--------------------------------------------

Yes a patch to fix actual problems found by cppcheck will help.  

This is actually a great janitor project to get your feet wet going through the code submission process on gerrit \[1].  Just supplying cppcheck output doesn't get much priority to do anything about the findings since most of what is identified are possible NULL dereferences or redundant code and not actual bugs.  Cleanup patches to eliminate the cppcheck noise need to be done on a module by module basis as a lot of the noise is in extended support modules that haven't been touched in years.

\[1] https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process

> several null pointer dereference (detected by cppcheck)
> -------------------------------------------------------
>
>                 Key: ASTERISK-27868
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27868
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: . I did not set the category correctly.
>    Affects Versions: 15.4.0
>            Reporter: Ilya Shipitsin
>            Assignee: Unassigned
>              Labels: pjsip
>
> {noformat}
> [addons/res_config_mysql.c:505] -> [addons/res_config_mysql.c:466]: (warning) Either the condition 'if(initfield)' is redundant or there is possible null pointer dereference: initfield.
> [apps/app_minivm.c:1262] -> [apps/app_minivm.c:1264]: (warning) Either the condition 'vmu' is redundant or there is possible null pointer dereference: vmu.
> [apps/app_minivm.c:1262] -> [apps/app_minivm.c:1265]: (warning) Either the condition 'vmu' is redundant or there is possible null pointer dereference: vmu.
> [apps/app_minivm.c:2190] -> [apps/app_minivm.c:2194]: (warning) Either the condition 'duration_string' is redundant or there is possible null pointer dereference: duration_string.
> [apps/app_minivm.c:3436] -> [apps/app_minivm.c:3440]: (warning) Either the condition 'countername' is redundant or there is possible null pointer dereference: countername.
> [channels/chan_mgcp.c:985] -> [channels/chan_mgcp.c:997]: (warning) Either the condition 'p' is redundant or there is possible null pointer dereference: p.
> [channels/chan_mgcp.c:2179] -> [channels/chan_mgcp.c:2176]: (warning) Either the condition '!sub' is redundant or there is possible null pointer dereference: sub.
> [channels/chan_mgcp.c:2659] -> [channels/chan_mgcp.c:2665]: (warning) Either the condition 'p' is redundant or there is possible null pointer dereference: p.
> [channels/chan_mgcp.c:2843] -> [channels/chan_mgcp.c:2841]: (warning) Either the condition 'sub?sub->id:-1' is redundant or there is possible null pointer dereference: sub.
> [channels/chan_mgcp.c:3474] -> [channels/chan_mgcp.c:3471]: (warning) Either the condition 'if(p)' is redundant or there is possible null pointer dereference: p.
> [channels/chan_misdn.c:6802] -> [channels/chan_misdn.c:6798]: (warning) Either the condition 'newbc?newbc->pid:-1' is redundant or there is possible null pointer dereference: newbc.
> [channels/chan_sip.c:13194] -> [channels/chan_sip.c:13208]: (warning) Either the condition 'max_packet_size' is redundant or there is possible null pointer dereference: max_packet_size.
> [channels/chan_skinny.c:7640] -> [channels/chan_skinny.c:7295]: (warning) Either the condition 'if(req)' is redundant or there is possible null pointer dereference: req.
> [channels/chan_unistim.c:5525] -> [channels/chan_unistim.c:5515]: (warning) Either the condition '!pte' is redundant or there is possible null pointer dereference: pte.
> [channels/chan_vpb.cc:2361] -> [channels/chan_vpb.cc:2363]: (warning) Either the condition 'fr' is redundant or there is possible null pointer dereference: fr.
> [channels/chan_vpb.cc:563] -> [channels/chan_vpb.cc:584]: (warning) Either the condition '!f' is redundant or there is possible null pointer dereference: f.
> [channels/misdn/isdn_lib.c:1936] -> [channels/misdn/isdn_lib.c:1934]: (warning) Either the condition 'if(hold_bc)' is redundant or there is possible null pointer dereference: hold_bc.
> [channels/misdn/isdn_lib.c:4536] -> [channels/misdn/isdn_lib.c:4535]: (warning) Either the condition '!stack' is redundant or there is possible null pointer dereference: stack.
> [codecs/lpc10/analys.c:457] -> [codecs/lpc10/analys.c:641]: (warning) Either the condition 'voice' is redundant or there is possible null pointer dereference: voice.
> [codecs/lpc10/analys.c:457] -> [codecs/lpc10/analys.c:642]: (warning) Either the condition 'voice' is redundant or there is possible null pointer dereference: voice.
> [codecs/lpc10/voicin.c:502] -> [codecs/lpc10/voicin.c:594]: (warning) Either the condition 'ivrc' is redundant or there is possible null pointer dereference: ivrc.
> [main/astfd.c:282] -> [main/astfd.c:283]: (warning) Either the condition '!ptr' is redundant or there is possible null pointer dereference: ptr.
> [main/astobj2.c:709] -> [main/astobj2.c:695]: (warning) Either the condition '(obj)==NULL' is redundant or there is possible null pointer dereference: obj.
> [main/astobj2.c:709] -> [main/astobj2.c:696]: (warning) Either the condition '(obj)==NULL' is redundant or there is possible null pointer dereference: obj.
> [main/astobj2.c:709] -> [main/astobj2.c:697]: (warning) Either the condition '(obj)==NULL' is redundant or there is possible null pointer dereference: obj.
> [main/astobj2.c:709] -> [main/astobj2.c:698]: (warning) Either the condition '(obj)==NULL' is redundant or there is possible null pointer dereference: obj.
> [main/astobj2.c:709] -> [main/astobj2.c:701]: (warning) Either the condition '(obj)==NULL' is redundant or there is possible null pointer dereference: obj.
> [main/pbx.c:1087] -> [main/pbx.c:1090]: (warning) Either the condition 'node' is redundant or there is possible null pointer dereference: node.
> [main/strings.c:367] -> [main/strings.c:365]: (warning) Either the condition '!buffer' is redundant or there is possible null pointer dereference: buffer.
> [res/ael/pval.c:3399] -> [res/ael/pval.c:2945]: (warning) Either the condition 'if(exten)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3399] -> [res/ael/pval.c:2949]: (warning) Either the condition 'if(exten)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3399] -> [res/ael/pval.c:2950]: (warning) Either the condition 'if(exten)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3039]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3040]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3687]: (warning) Either the condition 'if(exten&&exten->checked_switch)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3688]: (warning) Either the condition 'if(exten&&exten->checked_switch)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3706]: (warning) Either the condition 'if(exten&&exten->checked_switch)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3707]: (warning) Either the condition 'if(exten&&exten->checked_switch)' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3726]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3719] -> [res/ael/pval.c:3727]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3793] -> [res/ael/pval.c:3800]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3793] -> [res/ael/pval.c:3801]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3866] -> [res/ael/pval.c:3896]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3866] -> [res/ael/pval.c:3897]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3866] -> [res/ael/pval.c:3901]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/ael/pval.c:3866] -> [res/ael/pval.c:3902]: (warning) Either the condition 'exten' is redundant or there is possible null pointer dereference: exten.
> [res/res_config_ldap.c:1071] -> [res/res_config_ldap.c:1052]: (warning) Either the condition 'if(initfield&&!strcmp(initfield,var->name))' is redundant or there is possible null pointer dereference: initfield.
> [res/res_config_pgsql.c:629] -> [res/res_config_pgsql.c:580]: (warning) Either the condition 'if(initfield)' is redundant or there is possible null pointer dereference: initfield.
> [res/res_endpoint_stats.c:65] -> [res/res_endpoint_stats.c:47]: (warning) Either the condition 'old_snapshot' is redundant or there is possible null pointer dereference: snapshot.
> [res/res_endpoint_stats.c:65] -> [res/res_endpoint_stats.c:69]: (warning) Either the condition 'old_snapshot' is redundant or there is possible null pointer dereference: old_snapshot.
> [res/res_format_attr_celt.c:121] -> [res/res_format_attr_celt.c:132]: (warning) Either the condition 'attr1' is redundant or there is possible null pointer dereference: attr1.
> [res/res_format_attr_celt.c:121] -> [res/res_format_attr_celt.c:134]: (warning) Either the condition 'attr1' is redundant or there is possible null pointer dereference: attr1.
> [res/res_format_attr_celt.c:121] -> [res/res_format_attr_celt.c:134]: (warning) Either the condition 'attr2' is redundant or there is possible null pointer dereference: attr2.
> [res/res_format_attr_celt.c:121] -> [res/res_format_attr_celt.c:136]: (warning) Either the condition 'attr2' is redundant or there is possible null pointer dereference: attr2.
> [res/res_pjsip/pjsip_message_filter.c:113] -> [res/res_pjsip/pjsip_message_filter.c:119]: (warning) Either the condition 'transport_state' is redundant or there is possible null pointer dereference: transport_state.
> [res/res_pjsip_pubsub.c:677] -> [res/res_pjsip_pubsub.c:699]: (warning) Either the condition 'contact_hdr' is redundant or there is possible null pointer dereference: contact_hdr.
> [res/res_pjsip_registrar.c:273] -> [res/res_pjsip_registrar.c:272]: (warning) Either the condition '!path_str' is redundant or there is possible null pointer dereference: path_str.
> [res/res_pktccops.c:633] -> [res/res_pktccops.c:554]: (warning) Either the condition '(cmd==GATE_INFO||cmd==GATE_SET_HAVE_GATEID||cmd==GATE_DEL)&&gate' is redundant or there is possible null pointer dereference: gate.
> [res/res_rtp_asterisk.c:4087] -> [res/res_rtp_asterisk.c:4079]: (warning) Either the condition '!rtp' is redundant or there is possible null pointer dereference: rtp.
> [res/res_rtp_asterisk.c:4087] -> [res/res_rtp_asterisk.c:4084]: (warning) Either the condition '!rtp' is redundant or there is possible null pointer dereference: rtp.
> [tests/test_cdr.c:333] -> [tests/test_cdr.c:339]: (warning) Either the condition 'actual' is redundant or there is possible null pointer dereference: actual.
> [utils/db1-ast/btree/bt_open.c:407] -> [utils/db1-ast/btree/bt_open.c:401]: (warning) Either the condition 'envtmp?envtmp:"/tmp"' is redundant or there is possible null pointer dereference: envtmp.
> [utils/db1-ast/btree/bt_seq.c:393] -> [utils/db1-ast/btree/bt_seq.c:394]: (warning) Either the condition '(h=__mpool_get(t->bt_mp,h->prevpg,0))==NULL' is redundant or there is possible null pointer dereference: h.
> [utils/db1-ast/hash/hash_buf.c:279] -> [utils/db1-ast/hash/hash_buf.c:265]: (warning) Either the condition 'bp?bp->addr:0' is redundant or there is possible null pointer dereference: bp.
> [utils/db1-ast/hash/hash_buf.c:279] -> [utils/db1-ast/hash/hash_buf.c:268]: (warning) Either the condition 'bp?bp->addr:0' is redundant or there is possible null pointer dereference: bp.
> [utils/db1-ast/hash/hash_buf.c:279] -> [utils/db1-ast/hash/hash_buf.c:270]: (warning) Either the condition 'bp?bp->addr:0' is redundant or there is possible null pointer dereference: bp.
> [utils/db1-ast/hash/hash_buf.c:279] -> [utils/db1-ast/hash/hash_buf.c:278]: (warning) Either the condition 'bp?bp->addr:0' is redundant or there is possible null pointer dereference: bp.
> [utils/extconf.c:3152] -> [utils/extconf.c:2793]: (warning) Either the condition 'withcomments&&cfg' is redundant or there is possible null pointer dereference: cfg.
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list