systemd/backport-0012-CVE-2020-13776-parse-util-make-return-parameter-optional-in-safe_at.patch
2022-02-16 11:53:41 +08:00

33 lines
987 B
Diff

From aa85e4d3cef8ca8436e480bce9fa4ce72876b636 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 1 Jun 2020 17:10:27 +0200
Subject: [PATCH] parse-util: make return parameter optional in
safe_atou16_full()
All other safe_atoXYZ_full() functions have the parameter optional,
let's make it optoinal here, too.
Reference: https://github.com/systemd/systemd/commit/aa85e4d3cef8ca8436e480bce9fa4ce72876b636
Conflict: NA
---
src/basic/parse-util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
index 7344dc4311..c58f2cdda1 100644
--- a/src/basic/parse-util.c
+++ b/src/basic/parse-util.c
@@ -535,7 +535,9 @@ int safe_atou16_full(const char *s, unsigned base, uint16_t *ret) {
if ((unsigned long) (uint16_t) l != l)
return -ERANGE;
- *ret = (uint16_t) l;
+ if (ret)
+ *ret = (uint16_t) l;
+
return 0;
}
--
2.23.0