Closed Bug 824829 Opened 12 years ago Closed 12 years ago

crypto_alloc can return garbage

Categories

(Core :: WebRTC: Networking, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: n.nethercote, Unassigned)

References

(Blocks 1 open bug)

Details

clang complains:

netwerk/srtp/src/crypto/kernel/alloc.c:102:77 [-Wempty-body] suggest braces around empty body in an ‘else’ statement

The complaint is legit.  In a non-ENABLE_DEBUGGING build, |debug_print| disappears, in which case the |return ptr;| is pulled into the |else| branch.  So if malloc() succeeds the function will fall off the end and return garbage!
BTW, both implementations of crypto_alloc in that file suffer from this problem.
jesup pointed out that the semicolons mean the code is ok.  And dholbert filed a bug at http://sourceforge.net/tracker/index.php?func=detail&aid=3591521&group_id=38894&atid=423799 to quash the warning.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.