pesign/pesign-fix-authvar-write-loop.patch
Gary Ching-Pang Lin 2a0da6d5f1 - Update to 115
+ macros: drop %{_pesign_args}
  + Fix two bugs from package building
  + Fix bad free of cms data (DoS only)
  + Send pesign stdout/err to systemd journal
  + Add missing Install section
  + Add default packages for pkg-config
  + Short delay to ensure /run/pesign/socket exists
  + Resolve crash when signature that is removed is not the end of
    the list
  + Enhance error diagnostics about version mismatch
  + Upstream all Fedora changes
  + Add some hardening options to build
  + Add code of conduct
  + Fix build on gcc 12 and non-Fedora
- Refresh patches
  + harden_pesign.service.patch
  + pesign-boo1143063-remove-var-tracking.patch
  + pesign-boo1185663-set-rpmmacrodir.patch
  + pesign-fix-authvar-write-loop.patch
  + pesign-suse-build.patch
- Remove upstreamed/unnecessary patches
  + pesign-boo1158197-fix-pesigncheck-gcc10.patch
  + pesign-efikeygen-Fix-the-build-with-nss-3.44.patch
  + pesign-privkey_unneeded.diff
  + pesign-run.patch
  + Fix wrong oid offsets (bsc#1205323)

OBS-URL: https://build.opensuse.org/package/show/Base:System/pesign?expand=0&rev=66
2022-12-02 08:28:13 +00:00

51 lines
1.4 KiB
Diff

From b3c58e3b9237f90e865723837a9389fcb25f6945 Mon Sep 17 00:00:00 2001
From: Gary Ching-Pang Lin <glin@suse.com>
Date: Tue, 1 Jul 2014 14:43:35 +0800
Subject: [PATCH] authvar: fix the write loop
I forgot to move the pointer...
Also use offsetof() instead of the wordsize check.
Signed-off-by: Gary Ching-Pang Lin <glin@suse.com>
---
src/authvar_context.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
Index: pesign-115/src/authvar_context.c
===================================================================
--- pesign-115.orig/src/authvar_context.c
+++ pesign-115/src/authvar_context.c
@@ -151,6 +151,7 @@ write_authvar(authvar_context *ctx)
void *buffer, *ptr;
size_t buf_len, des_len, remain;
ssize_t wlen;
+ off_t offset;
if (!ctx->authinfo)
cmsreterr(-1, ctx->cms_ctx, "Not a valid authvar");
@@ -179,19 +180,19 @@ write_authvar(authvar_context *ctx)
if (ctx->value_size > 0)
memcpy(ptr, ctx->value, ctx->value_size);
- if (!ctx->to_firmware) {
- ftruncate(ctx->exportfd, buf_len);
+ if (!ctx->to_firmware)
lseek(ctx->exportfd, 0, SEEK_SET);
- }
remain = buf_len;
+ offset = 0;
do {
- wlen = write(ctx->exportfd, buffer, remain);
+ wlen = write(ctx->exportfd, buffer + offset, remain);
if (wlen < 0) {
free(buffer);
cmsreterr(-1, ctx->cms_ctx, "failed to write authvar");
}
remain -= wlen;
+ offset += wlen;
} while (remain > 0);
free(buffer);