[prev in list] [next in list] [prev in thread] [next in thread]
List: gnupg-commit-watchers
Subject: [gnutls-commits] CVS opencdk/src
From: "CVS User twoaday" <twoaday () gnutls ! org>
Date: 2007-11-26 13:42:35
Message-ID: E1IweEN-00037l-EX () trithemius ! gnupg ! org
[Download RAW message or body]
Update of /cvs/gnutls/opencdk/src
In directory trithemius:/tmp/cvs-serv11994/src
Modified Files:
stream.c
Log Message:
--- /cvs/gnutls/opencdk/src/stream.c 2007/11/24 14:33:17 1.94
+++ /cvs/gnutls/opencdk/src/stream.c 2007/11/26 13:42:34 1.95
@@ -1305,27 +1305,42 @@
cdk_stream_mmap_part (cdk_stream_t s, off_t off, size_t len,
byte **ret_buf, size_t *ret_buflen)
{
- off_t oldpos;
- int n;
cdk_error_t rc;
+ off_t oldpos;
+ int n;
- if (!s || !ret_buf || !ret_buflen)
+ if (!ret_buf || !ret_buflen)
return CDK_Inv_Value;
+ *ret_buf = NULL;
+ *ret_buflen = 0;
+
+ if (!s)
+ return CDK_Inv_Value;
+
+ /* Memory mapping is not supported on custom I/O objects. */
if (s->cbs_hd)
- return CDK_Inv_Mode;
+ {
+ _cdk_log_debug ("cdk_stream_mmap_part: not supported on callbacks\n");
+ return CDK_Inv_Mode;
+ }
- *ret_buflen = 0;
- *ret_buf = NULL;
oldpos = cdk_stream_tell (s);
rc = cdk_stream_flush (s);
- if (!rc)
- rc = cdk_stream_seek (s, off);
+ if (rc)
+ return rc;
+ rc = cdk_stream_seek (s, off);
if (rc)
return rc;
if (!len)
len = cdk_stream_get_length (s);
- if (!len || len > MAX_MAP_SIZE)
- return 0;
+ if (!len)
+ {
+ _cdk_log_debug ("cdk_stream_mmap_part: invalid file size %lu\n", len);
+ return s->error;
+ }
+ if (len > MAX_MAP_SIZE)
+ return CDK_Too_Short;
+
*ret_buf = cdk_calloc (1, len+1);
*ret_buflen = len;
n = cdk_stream_read (s, *ret_buf, len);
_______________________________________________
Gnutls-commits mailing list
Gnutls-commits@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnutls-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic