1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Fixed a bunch of little bugs as reported by Fabian Keil.

Still one problem left; marked with a gcc #warning.
This commit is contained in:
Werner Koch 2009-06-24 14:03:09 +00:00
parent e05aeca87b
commit 2e0ce7d97f
23 changed files with 79 additions and 29 deletions

View file

@ -1,3 +1,13 @@
2009-06-24 Werner Koch <wk@g10code.com>
* estream.c (es_read_line): In the malloc error case, set
MAX_LENGTH to 0 only if requested.
* xreadline.c (read_line): Ditto.
* estream.c (es_write_sanitized_utf8_buffer): Pass on error from
es_fputs.
* sexputil.c (get_rsa_pk_from_canon_sexp): Check for error after
the loop. Reported by Fabian Keil.
2009-06-03 Werner Koch <wk@g10code.com>
* estream.c (es_convert_mode): Rewrite and support the "x" flag.

View file

@ -450,8 +450,8 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
if (!mem_cookie->flags.grow)
{
/* We are not alloew to grow, thus limit the size to the left
space. FIXME: Does the grow flag an its semtics make sense
/* We are not allowed to grow, thus limit the size to the left
space. FIXME: Does the grow flag and its sematics make sense
at all? */
if (size > mem_cookie->memory_size - mem_cookie->offset)
size = mem_cookie->memory_size - mem_cookie->offset;
@ -463,7 +463,7 @@ es_func_mem_write (void *cookie, const void *buffer, size_t size)
size_t newsize;
newsize = mem_cookie->memory_size + mem_cookie->block_size;
#warning READ the code and see how it should work
newsize = mem_cookie->offset + size;
if (newsize < mem_cookie->offset)
{
@ -2797,7 +2797,9 @@ es_read_line (estream_t stream,
{
int save_errno = errno;
mem_free (buffer);
*length_of_buffer = *max_length = 0;
*length_of_buffer = 0;
if (max_length)
*max_length = 0;
ESTREAM_UNLOCK (stream);
errno = save_errno;
return -1;
@ -3203,7 +3205,7 @@ es_write_sanitized_utf8_buffer (estream_t stream,
*bytes_written = strlen (buf);
ret = es_fputs (buf, stream);
xfree (buf);
return i;
return rt == EOF? ret : (int)i;
}
else
return es_write_sanitized (stream, p, length, delimiters, bytes_written);

View file

@ -377,6 +377,9 @@ get_rsa_pk_from_canon_sexp (const unsigned char *keydata, size_t keydatalen,
return err;
}
if (err)
return err;
if (!rsa_n || !rsa_n_len || !rsa_e || !rsa_e_len)
return gpg_error (GPG_ERR_BAD_PUBKEY);

View file

@ -95,7 +95,9 @@ read_line (FILE *fp,
{
int save_errno = errno;
xfree (buffer);
*length_of_buffer = *max_length = 0;
*length_of_buffer = 0;
if (max_length)
*max_length = 0;
errno = save_errno;
return -1;
}