[tracker] UTF-16 strings' length with 3 \0 bytes at the end was calculated wrong
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] UTF-16 strings' length with 3 \0 bytes at the end was calculated wrong
- Date: Fri, 22 Jul 2011 10:44:11 +0000 (UTC)
commit 7bae03e97519ce786434a6d9457bc525e120a12f
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Jul 22 12:43:19 2011 +0200
UTF-16 strings' length with 3 \0 bytes at the end was calculated wrong
Fixes NB#274181.
src/tracker-extract/tracker-extract-mp3.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 3a01e0a..e6c57c0 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -1004,8 +1004,16 @@ id3v2_strlen (const gchar encoding,
switch (encoding) {
case 0x01:
case 0x02:
+
/* UTF-16, string terminated by two NUL bytes */
- pos = memmem (text, len, "\0\0", 2);
+ pos = memmem (text, len, "\0\0\0", 3);
+
+ if (pos == NULL) {
+ pos = memmem (text, len, "\0\0", 2);
+ } else {
+ pos++;
+ }
+
if (pos != NULL) {
return pos - text;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]