[Core] check_ice: sanitize second field of the candidates. Add new switch_is_uint_in_range() API.

This commit is contained in:
Andrey Volk
2023-08-01 19:33:17 +03:00
parent eb918fe180
commit 9347c96712
5 changed files with 60 additions and 7 deletions
+5 -4
View File
@@ -106,12 +106,13 @@ typedef struct icand_s {
} icand_t;
#define MAX_CAND 50
#define MAX_CAND_IDX_COUNT 2
typedef struct ice_s {
icand_t cands[MAX_CAND][2];
int cand_idx[2];
int chosen[2];
int is_chosen[2];
icand_t cands[MAX_CAND][MAX_CAND_IDX_COUNT];
int cand_idx[MAX_CAND_IDX_COUNT];
int chosen[MAX_CAND_IDX_COUNT];
int is_chosen[MAX_CAND_IDX_COUNT];
char *ufrag;
char *pwd;
char *options;
+8
View File
@@ -498,6 +498,14 @@ SWITCH_DECLARE(switch_size_t) switch_fp_read_dline(FILE *fd, char **buf, switch_
SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size);
SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone);
SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame);
/*! \brief Check if a 32 bit unsigned number is in a range.
* \param str string to check. Should not contain non-digit characters.
* \param from start of range including this number
* \param to end of range including this number
* \return true or false
*/
SWITCH_DECLARE(switch_bool_t) switch_is_uint_in_range(const char *str, unsigned int from, unsigned int to);
SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
SWITCH_DECLARE(switch_bool_t) switch_is_leading_number(const char *str);
SWITCH_DECLARE(char *) switch_find_parameter(const char *str, const char *param, switch_memory_pool_t *pool);