Closed Bug 1001539 Opened 10 years ago Closed 10 years ago

ccsip_pmh.c:1671:51: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion]

Categories

(Core :: WebRTC: Signaling, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: dholbert, Assigned: mt)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warning, which looks like a real issue:
====
media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_pmh.c:1671:51: warning: expression which evaluates to zero treated as a null pointer constant of type 'char *' [-Wnon-literal-null-conversion]

                     contact_params->expires_gmt = '\0';
                                                   ^~~~

Link to source:
http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/src/sipcc/core/sipstack/ccsip_pmh.c?rev=9defb9661f84#1671

The problem is that expires_gmt is a char*, so if we want to set it to the character '\0', we need to *dereference it*.

Alternately, if we want to set it to point to null (which is effectively what we're doing right now), we should set it to null.

Link to expires_gmt declaration (as a char*), for reference:
http://mxr.mozilla.org/mozilla-central/source/media/webrtc/signaling/src/sipcc/core/sipstack/h/ccsip_pmh.h?rev=c7e467ada390#220
On the other hand, it looks like this variable is set but never used:
 http://mxr.mozilla.org/mozilla-central/search?string=expires_gmt
so maybe it doesn't matter if it has a bogus value.
This entire subdirectory is a candidate for removal in bug 1001114, but for now, this can be fixed trivially by setting the pointer to NULL.

(The code isn't used by mozilla code, but it could be used by other consumers of the SIP stack.  Why they would get sipcc from us is beyond me, but...)
I haven't even run the tests yet, but I'm pretty confident about this one not causing any harm.
Assignee: nobody → martin.thomson
Status: NEW → ASSIGNED
Attachment #8412760 - Flags: review?(docfaraday)
Comment on attachment 8412760 [details] [diff] [review]
0001-Bug-1001529-Removing-compilation-warning.patch

Review of attachment 8412760 [details] [diff] [review]:
-----------------------------------------------------------------

Looks sane, considering that nothing ever reads that value.
Attachment #8412760 - Flags: review?(docfaraday) → review+
We don't use SIP contacts.  Someone other sipcc-consumer might, but they would be obligated to NULL-check, as they are currently.

This runs on my machine, passing all mochitests and signaling_unittests, so I'm going to go for broke.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6b04f015e541
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.