summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/tagcache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 850eaf9733..b485eb4647 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -783,7 +783,7 @@ static bool tempbuf_unique_insert(char *str, int id)
783 if (!strcasecmp(str, index[i].str)) 783 if (!strcasecmp(str, index[i].str))
784 { 784 {
785 tempbuf_left -= sizeof(struct tempbuf_id); 785 tempbuf_left -= sizeof(struct tempbuf_id);
786 if (tempbuf_left < 0) 786 if (tempbuf_left - 4 < 0)
787 return false; 787 return false;
788 788
789 idp = index[i].id; 789 idp = index[i].id;
@@ -791,6 +791,17 @@ static bool tempbuf_unique_insert(char *str, int id)
791 idp = idp->next; 791 idp = idp->next;
792 792
793 idp->next = (struct tempbuf_id *)&tempbuf[tempbuf_pos]; 793 idp->next = (struct tempbuf_id *)&tempbuf[tempbuf_pos];
794#ifdef ROCKBOX_STRICT_ALIGN
795 /* Make sure the entry is long aligned. */
796 if ((long)idp->next & 0x03)
797 {
798 int fix = 4 - ((long)idp->next & 0x03);
799 tempbuf_left -= fix;
800 tempbuf_pos += fix;
801 idp->next = (struct tempbuf_id *)((
802 (long)idp->next & ~0x03) + 0x04);
803 }
804#endif
794 idp = idp->next; 805 idp = idp->next;
795 idp->id = id; 806 idp->id = id;
796 idp->next = NULL; 807 idp->next = NULL;