From: Slawomir Bochenski <lkslawek@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Slawomir Bochenski <lkslawek@gmail.com>
Subject: [PATCH BlueZ] lib/sdp.c: Prevent passing unitialised argument
Date: Tue, 24 Jan 2012 14:22:43 +0100 [thread overview]
Message-ID: <1327411363-18773-1-git-send-email-lkslawek@gmail.com> (raw)
In case of sdp_seq_alloc() failures in loop, unitialised seqDTDs would
be passed to final sdp_seq_alloc.
---
lib/sdp.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index a48ee14..f618252 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -2523,11 +2523,15 @@ int sdp_set_profile_descs(sdp_record_t *rec, const sdp_list_t *profiles)
dtds[1] = &uint16;
values[1] = &profile->version;
seq = sdp_seq_alloc(dtds, values, 2);
- if (seq) {
- seqDTDs[i] = &seq->dtd;
- seqs[i] = seq;
- sdp_pattern_add_uuid(rec, &profile->uuid);
+
+ if (seq == NULL) {
+ status = -1;
+ break;
}
+
+ seqDTDs[i] = &seq->dtd;
+ seqs[i] = seq;
+ sdp_pattern_add_uuid(rec, &profile->uuid);
i++;
}
if (status == 0) {
--
1.7.4.1
next reply other threads:[~2012-01-24 13:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 13:22 Slawomir Bochenski [this message]
2012-06-28 10:51 ` [PATCH BlueZ] lib/sdp.c: Prevent passing unitialised argument Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1327411363-18773-1-git-send-email-lkslawek@gmail.com \
--to=lkslawek@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).