* [PATCH] Fix problem with operator name length
@ 2010-10-13 12:49 Lukasz Pawlik
2010-10-13 14:19 ` Johan Hedberg
0 siblings, 1 reply; 4+ messages in thread
From: Lukasz Pawlik @ 2010-10-13 12:49 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Pawlik
To follow the HFP specification we must ensure that network operator name
will have at maximum 16 characters. In current implementation we do not
check this constraint. This patch fix this. Now operator name with more
than 16 characters will be truncated to 16 characters.
---
audio/telephony-maemo6.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 1aac034..bbd2d2f 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -1498,8 +1498,7 @@ static void update_operator_name(const char *name)
return;
g_free(net.operator_name);
- net.operator_name = g_strdup(name);
-
+ net.operator_name = g_strndup(name, 16);
DBG("telephony-maemo6: operator name updated: %s", name);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix problem with operator name length
2010-10-13 12:49 [PATCH] Fix problem with operator name length Lukasz Pawlik
@ 2010-10-13 14:19 ` Johan Hedberg
2010-10-13 14:52 ` Dmitriy Paliy
0 siblings, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2010-10-13 14:19 UTC (permalink / raw)
To: Lukasz Pawlik; +Cc: linux-bluetooth
Hi Lukasz,
On Wed, Oct 13, 2010, Lukasz Pawlik wrote:
> - net.operator_name = g_strdup(name);
> -
> + net.operator_name = g_strndup(name, 16);
Is it possible that the the format of the name would be such that byte
boundaries are not always the same as character boundaries (e.g. UTF-8)?
If so, using g_strndup sounds dangerous since it assumes one byte per
character.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix problem with operator name length
2010-10-13 14:19 ` Johan Hedberg
@ 2010-10-13 14:52 ` Dmitriy Paliy
2010-10-13 15:09 ` Johan Hedberg
0 siblings, 1 reply; 4+ messages in thread
From: Dmitriy Paliy @ 2010-10-13 14:52 UTC (permalink / raw)
To: ext Johan Hedberg, Lukasz Pawlik; +Cc: linux-bluetooth@vger.kernel.org
Hi,
At the moment it is received in ascii from csd since not all car kits
can handle utf8.
Br,
Dmitriy
On Wed, 2010-10-13 at 16:19 +0200, ext Johan Hedberg wrote:
> Hi Lukasz,
>
> On Wed, Oct 13, 2010, Lukasz Pawlik wrote:
> > - net.operator_name = g_strdup(name);
> > -
> > + net.operator_name = g_strndup(name, 16);
>
> Is it possible that the the format of the name would be such that byte
> boundaries are not always the same as character boundaries (e.g. UTF-8)?
> If so, using g_strndup sounds dangerous since it assumes one byte per
> character.
>
> Johan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Fix problem with operator name length
2010-10-13 14:52 ` Dmitriy Paliy
@ 2010-10-13 15:09 ` Johan Hedberg
0 siblings, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2010-10-13 15:09 UTC (permalink / raw)
To: Dmitriy Paliy; +Cc: Lukasz Pawlik, linux-bluetooth@vger.kernel.org
Hi Dmitriy,
First of all, don't top-post on this list.
On Wed, Oct 13, 2010, Dmitriy Paliy wrote:
> At the moment it is received in ascii from csd since not all car kits
> can handle utf8.
Ok, in that case it should be safe. I went ahead and and pushed the
patch along with a clarification in the commit message about this
guarantee that the csd API gives.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-13 15:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13 12:49 [PATCH] Fix problem with operator name length Lukasz Pawlik
2010-10-13 14:19 ` Johan Hedberg
2010-10-13 14:52 ` Dmitriy Paliy
2010-10-13 15:09 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox