Skip to content

Commit 84b4f93

Browse files
iavEvilOlaf
authored andcommitted
rtl8192eu: cast pppoe_tag payload before byte offset in 7.1 patch
The three nat25_db_handle memcpy sites added byte offsets (MAGIC_CODE_LEN, RTL_RELAY_TAG_LEN) directly to a `struct pppoe_tag *`, so the offsets were scaled by sizeof(struct pppoe_tag) (4, packed) rather than bytes -- landing up to 32 bytes past tag_data and corrupting the PPPoE relay-tag path. It compiles clean (memcpy takes void *), so the build does not catch it. Cast to `unsigned char *` before applying the offset, matching the existing __nat25_add_pppoe_tag idiom in the same file. Assisted-by: Claude:claude-opus-4-8
1 parent 3c1c532 commit 84b4f93

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

patch/misc/wireless-rtl8192eu-linux-7.1.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ index a2c491e58b0a..5eaa74911801 100644
2929

3030
- memcpy(tag->tag_data + MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN,
3131
- pOldTag->tag_data, old_tag_len);
32-
+ memcpy((tag + 1) + MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN,
32+
+ memcpy((unsigned char *)(tag + 1) + MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN,
3333
+ (pOldTag + 1), old_tag_len);
3434

3535
if (skb_pull_and_merge(skb, (unsigned char *)pOldTag, TAG_HDR_LEN + old_tag_len) < 0) {
@@ -42,7 +42,7 @@ index a2c491e58b0a..5eaa74911801 100644
4242
+ pMagic = (unsigned short *)(tag + 1);
4343
*pMagic = htons(MAGIC_CODE);
4444
- memcpy(tag->tag_data + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN);
45-
+ memcpy((tag + 1) + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN);
45+
+ memcpy((unsigned char *)(tag + 1) + MAGIC_CODE_LEN, skb->data + ETH_ALEN, ETH_ALEN);
4646

4747
/* Add relay tag */
4848
if (__nat25_add_pppoe_tag(skb, tag) < 0)
@@ -59,7 +59,7 @@ index a2c491e58b0a..5eaa74911801 100644
5959
}
6060

6161
- memcpy(skb->data, tag->tag_data + MAGIC_CODE_LEN, ETH_ALEN);
62-
+ memcpy(skb->data, (tag + 1) + MAGIC_CODE_LEN, ETH_ALEN);
62+
+ memcpy(skb->data, (unsigned char *)(tag + 1) + MAGIC_CODE_LEN, ETH_ALEN);
6363

6464
if (tagLen > MAGIC_CODE_LEN + RTL_RELAY_TAG_LEN)
6565
offset = TAG_HDR_LEN;

0 commit comments

Comments
 (0)