Fix es_fopenmem and es_mopen bug.
authorWerner Koch <wk@gnupg.org>
Tue, 18 Jan 2011 11:49:28 +0000 (12:49 +0100)
committerWerner Koch <wk@gnupg.org>
Tue, 18 Jan 2011 11:49:28 +0000 (12:49 +0100)
common/estream.c

index bc25452..416aa83 100644 (file)
@@ -641,7 +641,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
       if (!mem_cookie->memory_size)
         newsize = size;  /* Not yet allocated.  */
       else
-        newsize = mem_cookie->memory_size + (nleft - size);
+        newsize = mem_cookie->memory_size + (size - nleft);
       if (newsize < mem_cookie->offset)
         {
           _set_errno (EINVAL);