1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-04 20:38:50 +01:00

Fix a bug in es_fopenmem etc.

This commit is contained in:
Werner Koch 2011-01-20 15:49:20 +01:00
parent 846d574407
commit abceb05d54
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,10 @@
2011-01-20 Werner Koch <wk@g10code.com>
* estream.c (es_func_mem_write): Fix computation of NEWSIZE.
2011-01-11 Werner Koch <wk@g10code.com> 2011-01-11 Werner Koch <wk@g10code.com>
Estream changes as used gnupg master from 2010-07-19. Estream changes as used by gnupg master from 2010-07-19.
* estream.c (es_fname_get, es_fname_set): New. * estream.c (es_fname_get, es_fname_set): New.
(fname_set_internal): New. (fname_set_internal): New.

View File

@ -497,7 +497,7 @@ typedef struct estream_cookie_mem
/* Create function for memory objects. DATA is either NULL or a user /* Create function for memory objects. DATA is either NULL or a user
supplied buffer with the initial conetnt of the memory buffer. If supplied buffer with the initial content of the memory buffer. If
DATA is NULL, DATA_N and DATA_LEN need to be 0 as well. If DATA is DATA is NULL, DATA_N and DATA_LEN need to be 0 as well. If DATA is
not NULL, DATA_N gives the allocated size of DATA and DATA_LEN the not NULL, DATA_N gives the allocated size of DATA and DATA_LEN the
used length in DATA. */ used length in DATA. */
@ -596,7 +596,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
if (!mem_cookie->memory_size) if (!mem_cookie->memory_size)
newsize = size; /* Not yet allocated. */ newsize = size; /* Not yet allocated. */
else else
newsize = mem_cookie->memory_size + (nleft - size); newsize = mem_cookie->memory_size + (size - nleft);
if (newsize < mem_cookie->offset) if (newsize < mem_cookie->offset)
{ {
_set_errno (EINVAL); _set_errno (EINVAL);