summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-06-24 16:03:09 +0200
committerWerner Koch <wk@gnupg.org>2009-06-24 16:03:09 +0200
commit2e0ce7d97f0de998cdf8e95e17ce169b7cae91cd (patch)
treec4042057b382f755d3bc1799e9c78d3355436fa2 /common
parentPost release updates (diff)
downloadgnupg2-2e0ce7d97f0de998cdf8e95e17ce169b7cae91cd.tar.xz
gnupg2-2e0ce7d97f0de998cdf8e95e17ce169b7cae91cd.zip
Fixed a bunch of little bugs as reported by Fabian Keil.
Still one problem left; marked with a gcc #warning.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog10
-rw-r--r--common/estream.c12
-rw-r--r--common/sexputil.c3
-rw-r--r--common/xreadline.c4
4 files changed, 23 insertions, 6 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 50669612e..dd2db13cb 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -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.
diff --git a/common/estream.c b/common/estream.c
index 214c2ff7d..d3557750d 100644
--- a/common/estream.c
+++ b/common/estream.c
@@ -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);
diff --git a/common/sexputil.c b/common/sexputil.c
index 7c6cb6af5..73608816d 100644
--- a/common/sexputil.c
+++ b/common/sexputil.c
@@ -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);
diff --git a/common/xreadline.c b/common/xreadline.c
index ab43c292a..8ca72b75f 100644
--- a/common/xreadline.c
+++ b/common/xreadline.c
@@ -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;
}