aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-27 11:05:47 +0100
committerMax Kellermann <max@duempel.org>2015-10-27 11:05:47 +0100
commit94f850a5885c89e5255948f9274aaaa4197bc52b (patch)
tree5348c92cb0ed9a3dc409be922abac07eee4438de /src/tag
parent3882c114505ea39e3707f27d91eb8ef363a8895b (diff)
parentdb9997a1068e00c5f78d4bb9834ce5a13e7b7a3b (diff)
downloadmpd-94f850a5885c89e5255948f9274aaaa4197bc52b.tar.gz
mpd-94f850a5885c89e5255948f9274aaaa4197bc52b.tar.xz
mpd-94f850a5885c89e5255948f9274aaaa4197bc52b.zip
Merge tag 'v0.19.11'
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/ApeLoader.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tag/ApeLoader.cxx b/src/tag/ApeLoader.cxx
index c42d088a8..b1759a730 100644
--- a/src/tag/ApeLoader.cxx
+++ b/src/tag/ApeLoader.cxx
@@ -79,12 +79,12 @@ ape_scan_internal(FILE *fp, ApeTagCallback callback)
/* get the key */
const char *key = p;
- while (remaining > size && *p != '\0') {
- p++;
- remaining--;
- }
- p++;
- remaining--;
+ const char *key_end = (const char *)memchr(p, '\0', remaining);
+ if (key_end == nullptr)
+ break;
+
+ p = key_end + 1;
+ remaining -= p - key;
/* get the value */
if (remaining < size)