fix: string_replace_at check args validity
This commit is contained in:
@@ -62,6 +62,10 @@ char *string_replace_at(const char *src, unsigned int from, unsigned int to,
|
|||||||
unsigned long rpl_len;
|
unsigned long rpl_len;
|
||||||
char *dst;
|
char *dst;
|
||||||
|
|
||||||
|
if (to < from) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
src_len = strnlen(src, STR_LEN * STR_LEN);
|
src_len = strnlen(src, STR_LEN * STR_LEN);
|
||||||
rpl_len = strnlen(rpl, STR_LEN * STR_LEN);
|
rpl_len = strnlen(rpl, STR_LEN * STR_LEN);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user