strongswan.org
Wiki/Project Management
Downloads
Gitweb
projects
/
strongswan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
27a814b
)
Properly read data from stream in pki --pkcs7
author
Tobias Brunner
<tobias@strongswan.org>
Thu, 24 Jan 2013 17:43:10 +0000
(18:43 +0100)
committer
Tobias Brunner
<tobias@strongswan.org>
Thu, 24 Jan 2013 18:13:41 +0000
(19:13 +0100)
src/pki/commands/pkcs7.c
patch
|
blob
|
history
diff --git
a/src/pki/commands/pkcs7.c
b/src/pki/commands/pkcs7.c
index
9f167d3
..
790656c
100644
(file)
--- a/
src/pki/commands/pkcs7.c
+++ b/
src/pki/commands/pkcs7.c
@@
-31,13
+31,16
@@
static chunk_t read_from_stream(FILE *stream)
while (TRUE)
{
len = fread(buf + total, 1, sizeof(buf) - total, stream);
- if (len <
0
)
+ if (len <
(sizeof(buf) - total)
)
{
- return chunk_empty;
- }
- if (len == 0)
- {
- return chunk_clone(chunk_create(buf, total));
+ if (ferror(stream))
+ {
+ return chunk_empty;
+ }
+ if (feof(stream))
+ {
+ return chunk_clone(chunk_create(buf, total + len));
+ }
}
total += len;
if (total == sizeof(buf))