Commit dc38e5e
authored
Fix memory leaks and improve error handling in req() function
1. Added curl_easy_cleanup(curl); to free resources after request
2. Changed to 2L (Enforces full hostname verification)
3. Added cleanup before calling error()
4. Properly convert to C-string XorStr("keyauth.win").c_str()
5. Proper Cleanup to Avoid Memory Leaks
Your original function doesn’t call curl_easy_cleanup(), which means CURL resources aren’t freed in case of errors.
this leads to memory leaks if the function is called multiple times (and its already called multiple times) almost every function
in keyAuth library use it.
Stronger SSL Security curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 1); only checks if the SSL certificate exists,
but does not verify the hostname properly.
Change it to curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
Enforces full hostname verification, preventing MITM attacks1 parent 6f33417 commit dc38e5e
1 file changed
+17
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1664 | 1664 | | |
1665 | 1665 | | |
1666 | 1666 | | |
1667 | | - | |
| 1667 | + | |
| 1668 | + | |
1668 | 1669 | | |
1669 | | - | |
1670 | | - | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
1671 | 1673 | | |
1672 | 1674 | | |
1673 | 1675 | | |
1674 | 1676 | | |
| 1677 | + | |
1675 | 1678 | | |
1676 | | - | |
1677 | | - | |
1678 | | - | |
1679 | | - | |
1680 | | - | |
| 1679 | + | |
1681 | 1680 | | |
1682 | 1681 | | |
1683 | | - | |
| 1682 | + | |
1684 | 1683 | | |
1685 | | - | |
1686 | 1684 | | |
1687 | 1685 | | |
1688 | | - | |
1689 | 1686 | | |
1690 | 1687 | | |
1691 | 1688 | | |
1692 | | - | |
1693 | | - | |
1694 | | - | |
1695 | | - | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
1696 | 1696 | | |
1697 | 1697 | | |
1698 | | - | |
| 1698 | + | |
1699 | 1699 | | |
1700 | 1700 | | |
| 1701 | + | |
1701 | 1702 | | |
1702 | 1703 | | |
1703 | 1704 | | |
| |||
0 commit comments