From fcfbcd4000e4cc7c5a8beede7bfec7a4a5ce7fc8 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 6 Apr 2006 13:11:12 +0000 Subject: [PATCH] * Check the magic bytes at the end of the buffer when cucul_load()ing it. --- cucul/cucul.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cucul/cucul.c b/cucul/cucul.c index 87eec85..56296f6 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -96,6 +96,10 @@ cucul_t *cucul_load(void *data, unsigned int size) if(size != 12 + width * height * 5 + 4) return NULL; + if(buf[size - 4] != 'A' || buf[size - 3] != 'C' + || buf[size - 2] != 'A' || buf[size - 1] != 'C') + return NULL; + qq = cucul_create(width, height); if(!qq)