Replace unsafe memory functions with safe versions

This commit is contained in:
yihaoDeng 2024-12-04 15:29:54 +08:00
parent ffa126da2a
commit 4d193bcf5d
2 changed files with 17 additions and 12 deletions

View File

@ -1916,6 +1916,7 @@ void s3EvictCache(const char *path, long object_size) {
}
long s3Size(const char *object_name) {
int32_t code = 0;
long size = 0;
cos_pool_t *p = NULL;
@ -1941,7 +1942,10 @@ long s3Size(const char *object_name) {
if (cos_status_is_ok(s)) {
char *content_length_str = (char *)apr_table_get(resp_headers, COS_CONTENT_LENGTH);
if (content_length_str != NULL) {
size = atol(content_length_str);
code = taosStr2Int64(content_length_str, &size);
if (code != 0) {
cos_warn_log("parse content length failed since %s\n", tstrerror(code));
}
}
cos_warn_log("head object succeeded: %ld\n", size);
} else {

View File

@ -41,10 +41,11 @@ void taos_monitor_split_str_metric(char** arr, taos_metric_t* metric, const char
memset(name, 0, size + 1);
memcpy(name, metric->name, size);
char* s = strtok(name, del);
char* saveptr;
char* s = strtok_r(name, del, &saveptr);
while (s != NULL) {
*arr++ = s;
s = strtok(NULL, del);
s = strtok_r(NULL, del, &saveptr);
}
*buf = name;