update sdk to 2.0,

fix potential buffer overflow issue in http_parser
This commit is contained in:
Arthur Lu 2024-09-18 10:46:19 -07:00
parent 55c465fab9
commit e55c54f292
5 changed files with 27 additions and 8 deletions

View File

@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0135 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0135 NEW)
set(PICO_SDK_FETCH_FROM_GIT on)
set(PICOTOOL_FETCH_FROM_GIT_PATH build/picotool)
set(PROGRAM_NAME pico_bmc)
set(PICO_BOARD pico_w)
include(pico_sdk_import.cmake)

View File

@ -81,7 +81,7 @@ void delete_request_parser (HTTP_REQUEST_PARSER_T * wrapper) {
typedef struct HTTP_RESPONSE_DATA_T_ {
llhttp_status_t status;
char type[32];
char type[128];
char body[128];
} HTTP_RESPONSE_DATA_T;

View File

@ -18,9 +18,20 @@ if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_PATH} AND (NOT PICO_SDK_FETCH_FROM_GIT_P
message("Using PICO_SDK_FETCH_FROM_GIT_PATH from environment ('${PICO_SDK_FETCH_FROM_GIT_PATH}')")
endif ()
if (DEFINED ENV{PICO_SDK_FETCH_FROM_GIT_TAG} AND (NOT PICO_SDK_FETCH_FROM_GIT_TAG))
set(PICO_SDK_FETCH_FROM_GIT_TAG $ENV{PICO_SDK_FETCH_FROM_GIT_TAG})
message("Using PICO_SDK_FETCH_FROM_GIT_TAG from environment ('${PICO_SDK_FETCH_FROM_GIT_TAG}')")
endif ()
if (PICO_SDK_FETCH_FROM_GIT AND NOT PICO_SDK_FETCH_FROM_GIT_TAG)
set(PICO_SDK_FETCH_FROM_GIT_TAG "master")
message("Using master as default value for PICO_SDK_FETCH_FROM_GIT_TAG")
endif()
set(PICO_SDK_PATH "${PICO_SDK_PATH}" CACHE PATH "Path to the Raspberry Pi Pico SDK")
set(PICO_SDK_FETCH_FROM_GIT "${PICO_SDK_FETCH_FROM_GIT}" CACHE BOOL "Set to ON to fetch copy of SDK from git if not otherwise locatable")
set(PICO_SDK_FETCH_FROM_GIT_PATH "${PICO_SDK_FETCH_FROM_GIT_PATH}" CACHE FILEPATH "location to download SDK")
set(PICO_SDK_FETCH_FROM_GIT_TAG "${PICO_SDK_FETCH_FROM_GIT_TAG}" CACHE FILEPATH "release tag for SDK")
if (NOT PICO_SDK_PATH)
if (PICO_SDK_FETCH_FROM_GIT)
@ -34,14 +45,14 @@ if (NOT PICO_SDK_PATH)
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
GIT_SUBMODULES_RECURSE FALSE
)
else ()
FetchContent_Declare(
pico_sdk
GIT_REPOSITORY https://github.com/raspberrypi/pico-sdk
GIT_TAG master
GIT_TAG ${PICO_SDK_FETCH_FROM_GIT_TAG}
)
endif ()

View File

@ -68,7 +68,9 @@ void key_pressed_worker_func(async_context_t * context, async_when_pending_worke
append_char(key);
}
else if (key == 27) { // escape & escape codes
while (getchar_timeout_us(0) > 0) {}
while (getchar_timeout_us(0) > 0) {
// TODO handle escape codes
}
break;
}
else { // other unhandled key

View File

@ -1,8 +1,8 @@
#ifndef SECRET_H
#define SECRET_H
const char BMC_HOSTNAME [] = "pico_bmc";
const char WIFI_SSID [] = "ssid";
const char WIFI_PASS [] = "pass";
const char BMC_HOSTNAME [64] = "pico_bmc";
const char WIFI_SSID [64] = "ssid";
const char WIFI_PASS [64] = "pass";
#endif