From 8060407875c1b7b1aaf9f5163abdd8de77058a25 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 24 Oct 2013 07:03:49 +0000 Subject: [PATCH] snd_umx.c (read_typname): made technically more correct (not that it matters for our case, but still..) git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@879 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/snd_umx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Quake/snd_umx.c b/Quake/snd_umx.c index 7373d5e1..1c233136 100644 --- a/Quake/snd_umx.c +++ b/Quake/snd_umx.c @@ -201,15 +201,15 @@ static int read_typname(fshandle_t *f, const struct upkg_hdr *hdr, char buf[64]; if (idx >= hdr->name_count) return -1; + buf[63] = '\0'; for (i = 0, l = 0; i <= idx; i++) { FS_fseek(f, hdr->name_offset + l, SEEK_SET); - FS_fread(buf, 1, 64, f); + FS_fread(buf, 1, 63, f); if (hdr->file_version >= 64) { s = *(signed char *)buf; /* numchars *including* terminator */ - if (s <= 0 || s >= 64) return -1; + if (s <= 0 || s > 64) return -1; l += s + 5; /* 1 for buf[0], 4 for int32_t name_flags */ } else { - buf[63] = 0; l += (long)strlen(buf); l += 5; /* 1 for terminator, 4 for int32_t name_flags */ }