diff options
author | Alex Yashchenko <alexhoppus111@gmail.com> | 2016-12-13 09:26:25 +0000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-12-14 18:33:14 +0800 |
commit | efcae7c931b473285e38c778bdaa9f36de9f78d6 (patch) | |
tree | b0079dc0efd34a5b56b992a1d32383f38ed2857a /include/net | |
parent | fbb726302a9ae06b373e04a54ad30eafa288dd10 (diff) |
sign-file: Fix inplace signing when src and dst names are both specified
When src and dst both are specified and they point to the same file
the sign-file utility will write only signature to the dst file and
the module (.ko file) body will not be written.
That happens because we open the same file with "rb" and "wb" flags,
from fopen man:
w Truncate file to zero length or create text file for writing.
The stream is positioned at the beginning of the file.
...
bm = BIO_new_file(module_name, "rb");
...
bd = BIO_new_file(dest_name, "wb");
...
while ((n = BIO_read(bm, buf, sizeof(buf))),
n > 0) {
ERR(BIO_write(bd, buf, n) < 0, "%s", dest_name);
}
...
Signed-off-by: Alex Yashchenko <alexhoppus111@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/net')
0 files changed, 0 insertions, 0 deletions