]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
minor unifier bug fix
authorAndrew Tridgell <tridge@samba.org>
Mon, 1 Apr 2002 03:26:49 +0000 (05:26 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 1 Apr 2002 03:26:49 +0000 (05:26 +0200)
unify.c

diff --git a/unify.c b/unify.c
index 1c3143ce6277941d6f12c2f3b94ded1a0e9d67b0..9864b3b7e036daf8a1378b60815589bb2b9dbd62 100644 (file)
--- a/unify.c
+++ b/unify.c
@@ -207,10 +207,10 @@ static void unify(unsigned char *p, size_t size)
 
                if (tokens[p[ofs]].type & C_TOKEN) {
                        q = p[ofs];
-                       for (i=0;tokens[q].num_toks;i++) {
+                       for (i=0;i<tokens[q].num_toks;i++) {
                                unsigned char *s = tokens[q].toks[i];
                                int len = strlen(s);
-                               if (strncmp(&p[ofs], s, len) == 0) {
+                               if (size >= ofs+len && memcmp(&p[ofs], s, len) == 0) {
                                        int j;
                                        for (j=0;s[j];j++) {
                                                pushchar(s[j]);
@@ -220,7 +220,9 @@ static void unify(unsigned char *p, size_t size)
                                        break;
                                }
                        }
-                       continue;
+                       if (i < tokens[q].num_toks) {
+                               continue;
+                       }
                }
 
                pushchar(p[ofs]);