Merge remote-tracking branch 'upstream/master'
diff --git a/.gitignore b/.gitignore
index 2eef09e..09170e2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,21 @@
 new.out
 *.o
 build
+
+# Files from Visual Studio Builds
+Debug
+Release
+
+# Files from emacs
+*~
+.#*
+*#
+
+# files from cmake
+*.vcxproj
+*.vcxproj.filters
+*.vcxproj.user
+CMakeFiles
+CMakeCache.txt
+*.cmake
+
diff --git a/src/cn-encoder.c b/src/cn-encoder.c
index d8a4d49..ffaf3e8 100644
--- a/src/cn-encoder.c
+++ b/src/cn-encoder.c
@@ -35,7 +35,7 @@
   ssize_t size;
 } cn_write_state;
 
-#define ensure_writable(sz) if ((ws->offset<0) || (ws->offset + (sz) >= ws->size)) { \
+#define ensure_writable(sz) if ((ws->offset<0) || (ws->offset + (sz) > ws->size)) { \
   ws->offset = -1; \
   return; \
 }