diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-10-21 00:04:57 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-10-21 00:04:57 +0000 |
commit | 9d3fddaa634752fa29d9562e28d492f2db58aeea (patch) | |
tree | 8a1422ac8ed5ddb0523c201a6d431d189c2e0c61 /firmware/bidi.c | |
parent | 10363b3a8178b791960fb7f048215ee8621fa074 (diff) | |
download | rockbox-9d3fddaa634752fa29d9562e28d492f2db58aeea.tar.gz rockbox-9d3fddaa634752fa29d9562e28d492f2db58aeea.zip |
Bugfix: bidi_l2v() returned a pointer to value on the stack when the argument was an empty string. * Don't protect against NULL pointer, that would be a bug in the caller.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11282 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/bidi.c')
-rw-r--r-- | firmware/bidi.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/firmware/bidi.c b/firmware/bidi.c index d2458e8963..a6f6b8c5d9 100644 --- a/firmware/bidi.c +++ b/firmware/bidi.c | |||
@@ -138,15 +138,15 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation) | |||
138 | //long max_chars=0; | 138 | //long max_chars=0; |
139 | //int begin, end, char_count, orig_begin; | 139 | //int begin, end, char_count, orig_begin; |
140 | 140 | ||
141 | if (!str || !*str) | ||
142 | return &(unsigned short){0}; | ||
143 | |||
144 | //tmp = str; | 141 | //tmp = str; |
145 | target = tmp = utf16_buf; | 142 | target = tmp = utf16_buf; |
146 | while (*str) | 143 | while (*str) |
147 | str = utf8decode(str, target++); | 144 | str = utf8decode(str, target++); |
148 | *target = 0; | 145 | *target = 0; |
149 | 146 | ||
147 | if (target == utf16_buf) /* empty string */ | ||
148 | return target; | ||
149 | |||
150 | /* properly join any arabic chars */ | 150 | /* properly join any arabic chars */ |
151 | arabjoin(utf16_buf, length); | 151 | arabjoin(utf16_buf, length); |
152 | 152 | ||