mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Include changes from review
This commit is contained in:
@@ -1,31 +1,43 @@
|
||||
#include<iostream>
|
||||
#include<memory>
|
||||
#include "../../../../../library-tests/string_concat/stl.h"
|
||||
|
||||
namespace std{
|
||||
struct CURL {};
|
||||
typedef CURL curl;
|
||||
enum curl_constant{
|
||||
CURLOPT_URL,
|
||||
CURLOPT_SSL_VERIFYHOST,
|
||||
CURLOPT_SSL_VERIFYPEER
|
||||
};
|
||||
|
||||
CURL *curl_easy_init();
|
||||
void curl_easy_cleanup(CURL *handle);
|
||||
void curl_easy_perform(CURL *handle);
|
||||
void curl_easy_setopt(CURL *handle, curl_constant param, int p);
|
||||
void curl_easy_setopt(CURL *handle, curl_constant param, char* p);
|
||||
}
|
||||
|
||||
#include<curl/curl.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
string host = "codeql.com"
|
||||
char host[] = "codeql.com";
|
||||
|
||||
void bad(void) {
|
||||
std::unique_ptr<CURL, void(*)(CURL*)> curl =
|
||||
std::unique_ptr<CURL, void(*)(CURL*)>(curl_easy_init(), curl_easy_cleanup);
|
||||
std::unique_ptr<CURL> curl = std::unique_ptr<CURL>(curl_easy_init());
|
||||
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_URL, host.c_str());
|
||||
curl_easy_perform(curl.get());
|
||||
curl_easy_setopt(curl.get(), CURLOPT_URL, host);
|
||||
curl_easy_perform(curl.get());
|
||||
}
|
||||
|
||||
void good(void) {
|
||||
std::unique_ptr<CURL, void(*)(CURL*)> curl =
|
||||
std::unique_ptr<CURL, void(*)(CURL*)>(curl_easy_init(), curl_easy_cleanup);
|
||||
std::unique_ptr<CURL> curl = std::unique_ptr<CURL>(curl_easy_init());
|
||||
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYPEER, 2);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_easy_setopt(curl.get(), CURLOPT_URL, host.c_str());
|
||||
curl_easy_perform(curl.get());
|
||||
curl_easy_setopt(curl.get(), CURLOPT_URL, host);
|
||||
curl_easy_perform(curl.get());
|
||||
}
|
||||
|
||||
int main(int c, char** argv){
|
||||
bad();
|
||||
good();
|
||||
}
|
||||
bad();
|
||||
good();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
a
|
||||
@@ -1 +0,0 @@
|
||||
semmle-extractor-options: command='g++ -lcurl'
|
||||
Reference in New Issue
Block a user