xbps-rindex: --sign bugfix to avoid garbage in the PEM RSA public key buffer.
This commit is contained in:
parent
4530c79bb2
commit
ee9479cc57
3
NEWS
3
NEWS
@ -1,5 +1,8 @@
|
|||||||
xbps-0.35 (???):
|
xbps-0.35 (???):
|
||||||
|
|
||||||
|
* xbps-rindex(8): fixed a bug while signing repositories in that sometimes
|
||||||
|
the PEM RSA public key buffer contained unwanted garbage.
|
||||||
|
|
||||||
* Make sure that required root symlinks in void are never removed or detected
|
* Make sure that required root symlinks in void are never removed or detected
|
||||||
as obsoletes; added new test cases to stress the code works as expected.
|
as obsoletes; added new test cases to stress the code works as expected.
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ static char *
|
|||||||
pubkey_from_privkey(RSA *rsa)
|
pubkey_from_privkey(RSA *rsa)
|
||||||
{
|
{
|
||||||
BIO *bp;
|
BIO *bp;
|
||||||
char *buf;
|
char *buf = NULL;
|
||||||
|
int len;
|
||||||
|
|
||||||
bp = BIO_new(BIO_s_mem());
|
bp = BIO_new(BIO_s_mem());
|
||||||
assert(bp);
|
assert(bp);
|
||||||
@ -85,9 +86,10 @@ pubkey_from_privkey(RSA *rsa)
|
|||||||
/* XXX (xtraeme) 8192 should be always enough? */
|
/* XXX (xtraeme) 8192 should be always enough? */
|
||||||
buf = malloc(8192);
|
buf = malloc(8192);
|
||||||
assert(buf);
|
assert(buf);
|
||||||
BIO_read(bp, buf, 8192);
|
len = BIO_read(bp, buf, 8191);
|
||||||
BIO_free(bp);
|
BIO_free(bp);
|
||||||
ERR_free_strings();
|
ERR_free_strings();
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -128,7 +130,7 @@ sign_repo(struct xbps_handle *xhp, const char *repodir,
|
|||||||
unsigned int siglen;
|
unsigned int siglen;
|
||||||
uint16_t rpubkeysize, pubkeysize;
|
uint16_t rpubkeysize, pubkeysize;
|
||||||
const char *arch, *pkgver, *rsignedby = NULL;
|
const char *arch, *pkgver, *rsignedby = NULL;
|
||||||
char *binpkg, *binpkg_sig, *buf, *defprivkey;
|
char *binpkg = NULL, *binpkg_sig = NULL, *buf = NULL, *defprivkey = NULL;
|
||||||
int binpkg_fd, binpkg_sig_fd, rv = 0;
|
int binpkg_fd, binpkg_sig_fd, rv = 0;
|
||||||
bool flush = false;
|
bool flush = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user