OSDN Git Service
(root)
/
android-x86
/
system-bt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5c16e7b
)
fix random crashes in bd2str caused by exceeding string array
author
Ganesh Ganapathi Batta
<ganeshg@broadcom.com>
Wed, 30 Apr 2014 00:32:14 +0000
(17:32 -0700)
committer
Matthew Xie
<mattx@google.com>
Tue, 6 May 2014 08:14:25 +0000
(
01:14
-0700)
remove all casts to avoid sign extension of bd address as this may
exceed the size of destination str buffer
Change-Id: I27dc7e61b52440c6b284b7e9931e6daa66afbf12
btif/src/btif_util.c
patch
|
blob
|
history
diff --git
a/btif/src/btif_util.c
b/btif/src/btif_util.c
index
96685f2
..
12aa7a9
100644
(file)
--- a/
btif/src/btif_util.c
+++ b/
btif/src/btif_util.c
@@
-85,7
+85,7
@@
int str2bd(char *str, bt_bdaddr_t *addr)
{
int32_t i = 0;
for (i = 0; i < 6; i++) {
- addr->address[i] = (uint8_t)
strtoul(str, (char **)
&str, 16);
+ addr->address[i] = (uint8_t)
strtoul(str,
&str, 16);
str++;
}
return 0;
@@
-95,10
+95,10
@@
char *bd2str(const bt_bdaddr_t *bdaddr, bdstr_t *bdstr)
{
const uint8_t *addr = bdaddr->address;
- s
nprintf((char*)bdstr, sizeof(*bdstr)
, "%02x:%02x:%02x:%02x:%02x:%02x",
+ s
printf(*bdstr
, "%02x:%02x:%02x:%02x:%02x:%02x",
addr[0], addr[1], addr[2],
addr[3], addr[4], addr[5]);
- return
(char *)
bdstr;
+ return
*
bdstr;
}
UINT32 devclass2uint(DEV_CLASS dev_class)