Closed Bug 852927 Opened 13 years ago Closed 11 years ago

Possible use of uninitialized variable in smimeutil.c

Categories

(NSS :: Libraries, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1132818

People

(Reporter: philippovmi, Unassigned)

Details

Attachments

(1 file)

Attached patch smimeutil.diffSplinter Review
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20130320 Firefox/22.0 Build ID: 20130320121908 Steps to reproduce: Compiled firefox with clang. Actual results: A warning occurred [maxim@mphilippov-linux]~/projects/mozilla/security/nss/lib/smime% clang -o /home/maxim/projects/mozilla/obj-x86_64-unknown-linux-gnu/security/nss/lib/smime/smimeutil.o -c -Os -gdwarf-2 -D_POSIX_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE -fPIC -DLINUX2_1 -Wall -Werror-implicit-function-declaration -Wno-switch -pipe -DLINUX -Dlinux -DHAVE_STRERROR -DXP_UNIX -UDEBUG -DNDEBUG -D_REENTRANT -DNSS_ENABLE_ECC -DUSE_UTIL_DIRECTLY -I/home/maxim/projects/mozilla/obj-x86_64-unknown-linux-gnu/dist/include/nspr -I/home/maxim/projects/mozilla/obj-x86_64-unknown-linux-gnu/dist/include/nspr -I/home/maxim/projects/mozilla/obj-x86_64-unknown-linux-gnu/security/build/../../dist/include/nss -I/home/maxim/projects/mozilla/obj-x86_64-unknown-linux-gnu/security/build/../../dist/private/nss smimeutil.c smimeutil.c:442:10: warning: variable 'key_type' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (key != NULL) { ^~~~~~~~~~~ smimeutil.c:448:10: note: uninitialized use occurs here if (key_type == ecKey) { ^~~~~~~~ smimeutil.c:442:6: note: remove the 'if' if its condition is always true if (key != NULL) { ^~~~~~~~~~~~~~~~~ smimeutil.c:427:6: note: variable 'key_type' is declared here KeyType key_type; ^ 1 warning generated. A `key' variable may be NULL, based on the definition of CERT_ExtractPublicKey, so `key_type' will be uninitialized in error case. I've attached a simple patch which may fix an issue.
Product: Core → MailNews Core
Version: Trunk → unspecified
Assignee: nobody → nobody
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Component: Security: S/MIME → Libraries
Product: MailNews Core → NSS
Resolution: --- → DUPLICATE
Version: unspecified → trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: