* [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname
@ 2011-10-10 7:22 Radoslaw Jablonski
2011-10-10 7:22 ` [PATCH obexd 2/2] Add NULL-field checking in vcard_printf_address Radoslaw Jablonski
2011-10-11 13:29 ` [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Johan Hedberg
0 siblings, 2 replies; 3+ messages in thread
From: Radoslaw Jablonski @ 2011-10-10 7:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Radoslaw Jablonski
If tag value is empty there is possibility to quickly create
empty tag without entering to rest of the logic.
Checking for empty parameter at the begining is included
basicaly in every print tag function in code - here somehow
was missing.
---
plugins/vcard.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/plugins/vcard.c b/plugins/vcard.c
index f1d9edc..c0a33cb 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -392,6 +392,11 @@ static void vcard_printf_fullname(GString *vcards, uint8_t format,
{
char field[LEN_MAX];
+ if (!text || strlen(text) == 0) {
+ vcard_printf(vcards, "FN:");
+ return;
+ }
+
if (select_qp_encoding(format, text, NULL)) {
vcard_qp_print_encoded(vcards, "FN", text, NULL);
return;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH obexd 2/2] Add NULL-field checking in vcard_printf_address
2011-10-10 7:22 [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Radoslaw Jablonski
@ 2011-10-10 7:22 ` Radoslaw Jablonski
2011-10-11 13:29 ` [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Radoslaw Jablonski @ 2011-10-10 7:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Radoslaw Jablonski
Without that checking strlen(..) could be called with NULL
as param and this will result crash (in some scenarios
'field' may be NULL)
---
plugins/vcard.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/plugins/vcard.c b/plugins/vcard.c
index c0a33cb..dc20a77 100644
--- a/plugins/vcard.c
+++ b/plugins/vcard.c
@@ -680,8 +680,11 @@ static void vcard_printf_address(GString *vcards, uint8_t format,
for (l = address->fields; l; l = l->next) {
char *field = l->data;
- set_escape(format, field_esc, field, LEN_MAX, strlen(field));
- g_strlcat(fields, field_esc, len);
+ if (field) {
+ set_escape(format, field_esc, field, LEN_MAX,
+ strlen(field));
+ g_strlcat(fields, field_esc, len);
+ }
if (l->next)
/* not adding ';' after last addr field */
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname
2011-10-10 7:22 [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Radoslaw Jablonski
2011-10-10 7:22 ` [PATCH obexd 2/2] Add NULL-field checking in vcard_printf_address Radoslaw Jablonski
@ 2011-10-11 13:29 ` Johan Hedberg
1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2011-10-11 13:29 UTC (permalink / raw)
To: Radoslaw Jablonski; +Cc: linux-bluetooth
Hi Radek,
On Mon, Oct 10, 2011, Radoslaw Jablonski wrote:
> If tag value is empty there is possibility to quickly create
> empty tag without entering to rest of the logic.
> Checking for empty parameter at the begining is included
> basicaly in every print tag function in code - here somehow
> was missing.
> ---
> plugins/vcard.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-11 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10 7:22 [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Radoslaw Jablonski
2011-10-10 7:22 ` [PATCH obexd 2/2] Add NULL-field checking in vcard_printf_address Radoslaw Jablonski
2011-10-11 13:29 ` [PATCH obexd 1/2] Add check for empty string in vcard_printf_fullname Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox