projects
/
platform
/
upstream
/
ofono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
35f7c4b
)
Fix length check for valid UCS2 starting with 0xff
author
Denis Kenzior
<denkenz@gmail.com>
Tue, 7 Jul 2009 18:49:32 +0000
(13:49 -0500)
committer
Denis Kenzior
<denkenz@gmail.com>
Tue, 7 Jul 2009 19:33:59 +0000
(14:33 -0500)
src/util.c
patch
|
blob
|
history
diff --git
a/src/util.c
b/src/util.c
index
70fa871
..
91116d0
100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-720,8
+720,15
@@
char *sim_string_to_utf8(const unsigned char *buffer, int length)
switch (buffer[0]) {
case 0x80:
+ if (((length - 1) % 2) == 1) {
+ if (buffer[length - 1] != 0xff)
+ return NULL;
+
+ length = length - 1;
+ }
+
for (i = 1; i < length; i += 2)
- if (buffer[i] == 0xff)
+ if (buffer[i] == 0xff
&& buffer[i + 1] == 0xff
)
break;
return g_convert(buffer + 1, i - 1,