Skip to content

Commit

Permalink
fix: fix when user-agent at bottom of header
Browse files Browse the repository at this point in the history
Signed-off-by: Zxilly <[email protected]>
  • Loading branch information
Zxilly committed May 6, 2021
1 parent e8a87c2 commit 466d5b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=UA2F
PKG_VERSION:=3.5
PKG_VERSION:=3.6

PKG_RELEASE:=8
PKG_RELEASE:=9


PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
Expand Down
8 changes: 4 additions & 4 deletions src/ua2f.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ static int queue_cb(const struct nlmsghdr *nlh, void *data) {
if (tcppkpayload) {
char *uapointer = memmem(tcppkpayload, tcppklen, "\r\nUser", 6);
if (uapointer) {
uapointer = memmem(tcppkpayload, tcppklen, "\r\nUser-Agent: ", 14);
uapointer = memmem(tcppkpayload, tcppklen, "\r\nUser-Agent:", 13);
if (!uapointer){
uapointer = memmem(tcppkpayload, tcppklen, "\r\nUser-agent: ", 14);
uapointer = memmem(tcppkpayload, tcppklen, "\r\nUser-agent:", 13);
}
} else {
uapointer = memmem(tcppkpayload, tcppklen, "\r\nuser-agent: ", 14);
uapointer = memmem(tcppkpayload, tcppklen, "\r\nuser-agent:", 13);
}

if (uapointer) {
Expand All @@ -276,7 +276,7 @@ static int queue_cb(const struct nlmsghdr *nlh, void *data) {
debugflag++; //flag6

uaoffset = uapointer - tcppkpayload + 14;
for (int i = 0; i < tcppklen - uaoffset - 4; ++i) {
for (int i = 0; i < tcppklen - uaoffset - 2; ++i) {
if (*(uapointer + 14 + i) == '\r') {
ualength = i;
break;
Expand Down

0 comments on commit 466d5b1

Please sign in to comment.