Merge pull request #127 from lededev/gcc13

fix gcc13 warning pointer used after free()
This commit is contained in:
有種 2024-02-16 10:18:44 +08:00 committed by GitHub
commit 830691eb12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,17 @@
diff -ur a/server/server.c b/server/server.c
--- a/server/server.c
+++ b/server/server.c
@@ -1942,12 +1942,12 @@
text = (char*)malloc(strlen(protocol) - 11);
memcpy(text, protocol, strlen(protocol) - 11);
int length = strlen(protocol) - 11;
- free(protocol);
obfs = (char*)malloc(length);
memset(protocol, 0x00, length);
memcpy(protocol, text, length);
LOGI("protocol compatible enable, %s", protocol);
free(text);
+ free(protocol);
protocol_compatible = 1;
}
}