| 295 | } |
| 296 | |
| 297 | char *av_append_path_component(const char *path, const char *component) |
| 298 | { |
| 299 | size_t p_len, c_len; |
| 300 | char *fullpath; |
| 301 | |
| 302 | if (!path) |
| 303 | return av_strdup(component); |
| 304 | if (!component) |
| 305 | return av_strdup(path); |
| 306 | |
| 307 | p_len = strlen(path); |
| 308 | c_len = strlen(component); |
| 309 | if (p_len > SIZE_MAX - c_len || p_len + c_len > SIZE_MAX - 2) |
| 310 | return NULL; |
| 311 | fullpath = av_malloc(p_len + c_len + 2); |
| 312 | if (fullpath) { |
| 313 | if (p_len) { |
| 314 | av_strlcpy(fullpath, path, p_len + 1); |
| 315 | if (c_len) { |
| 316 | if (fullpath[p_len - 1] != '/' && component[0] != '/') |
| 317 | fullpath[p_len++] = '/'; |
| 318 | else if (fullpath[p_len - 1] == '/' && component[0] == '/') |
| 319 | p_len--; |
| 320 | } |
| 321 | } |
| 322 | av_strlcpy(&fullpath[p_len], component, c_len + 1); |
| 323 | fullpath[p_len + c_len] = 0; |
| 324 | } |
| 325 | return fullpath; |
| 326 | } |
| 327 | |
| 328 | int av_escape(char **dst, const char *src, const char *special_chars, |
| 329 | enum AVEscapeMode mode, int flags) |
no test coverage detected