projects
/
libdcp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3938e58
)
Missing error checking on writing KDMs as XML.
author
Carl Hetherington
<cth@carlh.net>
Tue, 6 Oct 2020 09:26:14 +0000
(11:26 +0200)
committer
Carl Hetherington
<cth@carlh.net>
Tue, 6 Oct 2020 09:26:14 +0000
(11:26 +0200)
src/encrypted_kdm.cc
patch
|
blob
|
history
diff --git
a/src/encrypted_kdm.cc
b/src/encrypted_kdm.cc
index 071bf87090596f6b2dad69899423a58183683271..e8e8987085014297831f97880c2edcd90c783272 100644
(file)
--- a/
src/encrypted_kdm.cc
+++ b/
src/encrypted_kdm.cc
@@
-707,9
+707,15
@@
void
EncryptedKDM::as_xml (boost::filesystem::path path) const
{
FILE* f = fopen_boost (path, "w");
+ if (!f) {
+ throw FileError ("Could not open KDM file for writing", path, errno);
+ }
string const x = as_xml ();
- fwrite (x.c_str(), 1, x.length(), f);
+
size_t const written =
fwrite (x.c_str(), 1, x.length(), f);
fclose (f);
+ if (written != x.length()) {
+ throw FileError ("Could not write to KDM file", path, errno);
+ }
}
string