diff --git a/bin/Makefile b/bin/Makefile index 225ba8d..6b4932d 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -29,7 +29,7 @@ ifeq ($(OS),LINUX) CFLAGS += -D_POSIX_SOURCE endif ifdef DEBUG -CFLAGS += -W -Wall -Wextra -Wmissing-prototypes -Winline -Wcast-align \ +CFLAGS += -W -Wall -Wextra -Wpointer-arith -Wmissing-prototypes -Winline -Wcast-align \ -Wmissing-declarations -fno-inline -g3 -DDEBUG -DLUA_USE_APICHECK -std=c99 else CFLAGS += -O2 -funroll-loops -pipe -std=c99 diff --git a/src/pack.c b/src/pack.c index 46d5fbd..fb7ce46 100644 --- a/src/pack.c +++ b/src/pack.c @@ -382,6 +382,7 @@ long pack_tell(Packfile* file) { void* pack_readfile(const char* packfile, const char* filename, uint32_t* filesize) { Packfile* file = (Packfile*)malloc(sizeof(Packfile)); void* buf; + char* str; int size, bytes; if(filesize) @@ -409,7 +410,8 @@ void* pack_readfile(const char* packfile, const char* filename, uint32_t* filesi return NULL; } DEBUG("Read %d bytes from '%s'", bytes, filename); - memset(buf+size, 0, 1); /* Append size '\0' for it to validate as a string. */ + str = buf; + str[size] = '\0'; /* Append size '\0' for it to validate as a string. */ /* Check the md5. */ md5_state_t md5;