Made safe version of string concat with delimiter
This commit is contained in:
parent
11b63cbe3d
commit
c83dced0d2
12
file_path.c
12
file_path.c
|
@ -926,6 +926,18 @@ void fill_pathname_join(char *out_path,
|
||||||
rarch_assert(strlcat(out_path, path, size) < size);
|
rarch_assert(strlcat(out_path, path, size) < size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fill_pathname_join_delim(char *out_path, const char *dir,
|
||||||
|
const char *path, const char delim, size_t size)
|
||||||
|
{
|
||||||
|
size_t copied = strlcpy(out_path, dir, size);
|
||||||
|
rarch_assert(copied < size+1);
|
||||||
|
|
||||||
|
out_path[copied]=delim;
|
||||||
|
out_path[copied+1] = '\0';
|
||||||
|
|
||||||
|
rarch_assert(strlcat(out_path, path, size) < size);
|
||||||
|
}
|
||||||
|
|
||||||
void fill_pathname_expand_special(char *out_path,
|
void fill_pathname_expand_special(char *out_path,
|
||||||
const char *in_path, size_t size)
|
const char *in_path, size_t size)
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,6 +193,10 @@ void fill_pathname_resolve_relative(char *out_path, const char *in_refpath,
|
||||||
void fill_pathname_join(char *out_path, const char *dir,
|
void fill_pathname_join(char *out_path, const char *dir,
|
||||||
const char *path, size_t size);
|
const char *path, size_t size);
|
||||||
|
|
||||||
|
/* Joins a directory and path together using the given char. */
|
||||||
|
void fill_pathname_join_delim(char *out_path, const char *dir,
|
||||||
|
const char *path, const char delim, size_t size);
|
||||||
|
|
||||||
/* Generates a short representation of path. It should only
|
/* Generates a short representation of path. It should only
|
||||||
* be used for displaying the result; the output representation is not
|
* be used for displaying the result; the output representation is not
|
||||||
* binding in any meaningful way (for a normal path, this is the same as basename)
|
* binding in any meaningful way (for a normal path, this is the same as basename)
|
||||||
|
|
Loading…
Reference in New Issue