diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2006-05-27 11:21:08 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2006-05-27 11:21:08 +0000 |
commit | 196b770a96920e93dff514b9173d290bf73d0a81 (patch) | |
tree | f8a972d7892fb2f152dc8d58a37f6dc7d41c7109 /apps/tagcache.c | |
parent | 45975987b2a18b607c35e05aa7090f102246fdcc (diff) | |
download | rockbox-196b770a96920e93dff514b9173d290bf73d0a81.tar.gz rockbox-196b770a96920e93dff514b9173d290bf73d0a81.zip |
Init dircache after applying settings and use a splash. Possible prevent
some type of buffer overflow with tagcache.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9997 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 127c6aa63a..f4e139aafa 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -1427,7 +1427,6 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
1427 | 1427 | ||
1428 | tempbufidx = 0; | 1428 | tempbufidx = 0; |
1429 | tempbuf_pos = TAGFILE_MAX_ENTRIES * sizeof(struct tempbuf_searchidx); | 1429 | tempbuf_pos = TAGFILE_MAX_ENTRIES * sizeof(struct tempbuf_searchidx); |
1430 | memset(tempbuf+tempbuf_pos, 0, LOOKUP_BUF_DEPTH * sizeof(void **)); | ||
1431 | tempbuf_pos += LOOKUP_BUF_DEPTH * sizeof(void **); | 1430 | tempbuf_pos += LOOKUP_BUF_DEPTH * sizeof(void **); |
1432 | tempbuf_left = tempbuf_size - tempbuf_pos - 8; | 1431 | tempbuf_left = tempbuf_size - tempbuf_pos - 8; |
1433 | if (tempbuf_left - TAGFILE_ENTRY_AVG_LENGTH * TAGFILE_MAX_ENTRIES < 0) | 1432 | if (tempbuf_left - TAGFILE_ENTRY_AVG_LENGTH * TAGFILE_MAX_ENTRIES < 0) |
@@ -1438,6 +1437,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
1438 | 1437 | ||
1439 | lookup = (struct tempbuf_searchidx **) | 1438 | lookup = (struct tempbuf_searchidx **) |
1440 | (tempbuf + sizeof(struct tempbuf_searchidx)*TAGFILE_MAX_ENTRIES); | 1439 | (tempbuf + sizeof(struct tempbuf_searchidx)*TAGFILE_MAX_ENTRIES); |
1440 | memset(lookup, 0, LOOKUP_BUF_DEPTH * sizeof(void **)); | ||
1441 | 1441 | ||
1442 | /* Open the index file, which contains the tag names. */ | 1442 | /* Open the index file, which contains the tag names. */ |
1443 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, index_type); | 1443 | snprintf(buf, sizeof buf, TAGCACHE_FILE_INDEX, index_type); |
@@ -2024,7 +2024,7 @@ static bool allocate_tagcache(void) | |||
2024 | sizeof(struct ramcache_header) + TAG_COUNT*sizeof(void *); | 2024 | sizeof(struct ramcache_header) + TAG_COUNT*sizeof(void *); |
2025 | logf("tagcache: %d bytes allocated.", stat.ramcache_allocated); | 2025 | logf("tagcache: %d bytes allocated.", stat.ramcache_allocated); |
2026 | logf("at: 0x%04x", audiobuf); | 2026 | logf("at: 0x%04x", audiobuf); |
2027 | audiobuf += (long)((stat.ramcache_allocated & ~0x03) + 0x04); | 2027 | audiobuf += (long)((stat.ramcache_allocated & ~0x03) + 128); |
2028 | 2028 | ||
2029 | return true; | 2029 | return true; |
2030 | } | 2030 | } |