1 Star 0 Fork 48

fe.zhang/systemd

forked from src-anolis-os/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0400-sd-bus-avoid-magic-number-in-SASL-length-calculation.patch 1.82 KB
一键复制 编辑 原始数据 按行查看 历史
geliwei 提交于 2021-06-16 16:46 . update to systemd-239-45.el8.src.rpm
From d524f9f9089b71d83e991ed42d25a4616ec575a2 Mon Sep 17 00:00:00 2001
From: David Rheinsberg <david.rheinsberg@gmail.com>
Date: Thu, 14 Mar 2019 13:26:50 +0100
Subject: [PATCH] sd-bus: avoid magic number in SASL length calculation
Lets avoid magic numbers and use a constant `strlen()` instead.
Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
(cherry picked from commit 3cacdab925c40a5d9b7cf3f67719201bbaa17f67)
Related: #1838081
---
src/libsystemd/sd-bus/bus-socket.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
index 4a72795d2b..1c8b331b48 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -390,7 +390,9 @@ static int bus_socket_auth_verify_server(sd_bus *b) {
if (line_begins(line, l, "AUTH ANONYMOUS")) {
- r = verify_anonymous_token(b, line + 14, l - 14);
+ r = verify_anonymous_token(b,
+ line + strlen("AUTH ANONYMOUS"),
+ l - strlen("AUTH ANONYMOUS"));
if (r < 0)
return r;
if (r == 0)
@@ -402,7 +404,9 @@ static int bus_socket_auth_verify_server(sd_bus *b) {
} else if (line_begins(line, l, "AUTH EXTERNAL")) {
- r = verify_external_token(b, line + 13, l - 13);
+ r = verify_external_token(b,
+ line + strlen("AUTH EXTERNAL"),
+ l - strlen("AUTH EXTERNAL"));
if (r < 0)
return r;
if (r == 0)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fe_zhang/systemd.git
git@gitee.com:fe_zhang/systemd.git
fe_zhang
systemd
systemd
a8

搜索帮助