linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] lib/sdp.c: Prevent passing unitialised argument
@ 2012-01-24 13:22 Slawomir Bochenski
  2012-06-28 10:51 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Slawomir Bochenski @ 2012-01-24 13:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Slawomir Bochenski

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-28 10:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24 13:22 [PATCH BlueZ] lib/sdp.c: Prevent passing unitialised argument Slawomir Bochenski
2012-06-28 10:51 ` Johan Hedberg

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).