Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sipsess coverity warning #432

Closed
sreimers opened this issue Jul 13, 2022 · 0 comments · Fixed by #433
Closed

sipsess coverity warning #432

sreimers opened this issue Jul 13, 2022 · 0 comments · Fixed by #433

Comments

@sreimers
Copy link
Member

** CID 274764:  Null pointer dereferences  (REVERSE_INULL)
/src/sipsess/connect.c: 91 in invite_resp_handler()


________________________________________________________________________________________________________
*** CID 274764:  Null pointer dereferences  (REVERSE_INULL)
/src/sipsess/connect.c: 91 in invite_resp_handler()
85     	if (msg->scode < 200) {
86     		sess->progrh(msg, sess->arg);
87     
88     		if (sip_msg_hdr_has_value(msg, SIP_HDR_REQUIRE, "100rel")
89     				&& sess->rel100_supported) {
90     
>>>     CID 274764:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "msg" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
91     			if (msg && mbuf_get_left(msg->mb)) {
92     				if (sess->sent_offer) {
93     					sess->awaiting_answer = false;
94     					err = sess->answerh(msg, sess->arg);
95     					if (err)
96     						goto out;

** CID 274763:  Control flow issues  (DEADCODE)
/src/sipsess/accept.c: 113 in sipsess_accept()


________________________________________________________________________________________________________
*** CID 274763:  Control flow issues  (DEADCODE)
/src/sipsess/accept.c: 113 in sipsess_accept()
107     	}
108     	else if (scode >= 200) {
109     		err = sipsess_reply_2xx(sess, msg, scode, reason, desc,
110     					fmt, &ap);
111     	}
112     	else {
>>>     CID 274763:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "struct sip_contact contact;".
113     		struct sip_contact contact;
114     
115     		sip_contact_set(&contact, sess->cuser, &msg->dst, msg->tp);
116     
117     		err = sip_treplyf(&sess->st, NULL, sess->sip,
118     				  msg, true, scode, reason,

@cspiel1 @maximilianfridrich can you check this?

maximilianfridrich added a commit to maximilianfridrich/re that referenced this issue Jul 13, 2022
remove unneccessary null check and remove dead code part that is covered
by sipsess_reply_xx functions.

fixes baresip#432
maximilianfridrich added a commit to maximilianfridrich/re that referenced this issue Jul 13, 2022
add sanity checks to invite_resp_handler and remove dead code part that
is covered by sipsess_reply_xx functions.

fixes baresip#432
sreimers pushed a commit that referenced this issue Jul 13, 2022
add sanity checks to invite_resp_handler and remove dead code part that
is covered by sipsess_reply_xx functions.

fixes #432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant