-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cherry-pick][201911] Fix dhcp option buffer issue (#12520)
Why I did it #12033 How I did it How to verify it
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/isc-dhcp/patch/0014-Fix-dhcrelay-agent-option-buffer-pointer-logic.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 0a2f9a62bceb90b0d30461add2e25c4ce7a24547 Mon Sep 17 00:00:00 2001 | ||
From: Thomas Markwalder <[email protected]> | ||
Date: Fri, 20 Dec 2019 10:11:54 -0500 | ||
Subject: [PATCH] [#71] Fix dhcrelay agent option buffer pointer logic | ||
|
||
relay/dhcrelay.c | ||
strip_relay_agent_options() | ||
strip_relay_agent_options() | ||
- corrected buffer pointer logic | ||
|
||
--- | ||
relay/dhcrelay.c | 18 ++++++++++++++---- | ||
1 file changed, 14 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c | ||
index 896e1e2e..980dacae 100644 | ||
--- a/relay/dhcrelay.c | ||
+++ b/relay/dhcrelay.c | ||
@@ -1065,8 +1065,13 @@ strip_relay_agent_options(struct interface_info *in, | ||
return (0); | ||
|
||
if (sp != op) { | ||
- memmove(sp, op, op[1] + 2); | ||
- sp += op[1] + 2; | ||
+ size_t mlen = op[1] + 2; | ||
+ memmove(sp, op, mlen); | ||
+ sp += mlen; | ||
+ if (sp > max) { | ||
+ return (0); | ||
+ } | ||
+ | ||
op = nextop; | ||
} else | ||
op = sp = nextop; | ||
@@ -1168,8 +1168,13 @@ add_relay_agent_options(struct interface_info *ip, struct dhcp_packet *packet, | ||
end_pad = NULL; | ||
|
||
if (sp != op) { | ||
- memmove(sp, op, op[1] + 2); | ||
- sp += op[1] + 2; | ||
+ size_t mlen = op[1] + 2; | ||
+ memmove(sp, op, mlen); | ||
+ sp += mlen; | ||
+ if (sp > max) { | ||
+ return (0); | ||
+ } | ||
+ | ||
op = nextop; | ||
} else | ||
op = sp = nextop; | ||
-- | ||
2.17.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters