]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
509: fix printing uninitialized stack memory when OID is empty
authorEric Biggers <ebiggers3@gmail.com>
Fri, 8 Dec 2017 15:13:28 +0000 (15:13 +0000)
committerSasha Levin <alexander.levin@microsoft.com>
Sun, 4 Mar 2018 15:28:27 +0000 (10:28 -0500)
commit233c8536bf579f6908fc27c050302475afbbef75
tree40281b705da4af06642f9f7b5c8e6c69298128bb
parentbcc0c138f9aabb1234319b9a34c84a482cea8d45
509: fix printing uninitialized stack memory when OID is empty

[ Upstream commit 8dfd2f22d3bf3ab7714f7495ad5d897b8845e8c1 ]

Callers of sprint_oid() do not check its return value before printing
the result.  In the case where the OID is zero-length, -EBADMSG was
being returned without anything being written to the buffer, resulting
in uninitialized stack memory being printed.  Fix this by writing
"(bad)" to the buffer in the cases where -EBADMSG is returned.

Fixes: 4f73175d0375 ("X.509: Add utility functions to render OIDs as strings")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
lib/oid_registry.c