diff options
| author | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-02 15:13:29 +0000 |
|---|---|---|
| committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-02 15:13:29 +0000 |
| commit | 5544f503bf0fcfd050b4e338e8ec7b22e2f53b9a (patch) | |
| tree | 2d65f1fd285c450cbb1c676697ad13b5a47a835c /src/proxy/proxystrings.h | |
| parent | b3fa8537c411e6e2d53044b1d5d20c361d2ad17d (diff) | |
Big cleanup in functions writing to a char buffer without proper size boundary.
Diffstat (limited to 'src/proxy/proxystrings.h')
| -rwxr-xr-x | src/proxy/proxystrings.h | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/src/proxy/proxystrings.h b/src/proxy/proxystrings.h index 8dc371a..dc70286 100755 --- a/src/proxy/proxystrings.h +++ b/src/proxy/proxystrings.h @@ -85,35 +85,21 @@ HTS_UNUSED static void escapexml(const char *s, String * tempo) { } } -HTS_UNUSED static char *concat(char *catbuff, const char *a, const char *b) { - if (a != NULL && a[0] != '\0') { - strcpy(catbuff, a); - } else { - catbuff[0] = '\0'; - } - if (b != NULL && b[0] != '\0') { - strcat(catbuff, b); - } - return catbuff; -} - -HTS_UNUSED static char *__fconv(char *a) { -#ifdef WIN32 - int i; - - for(i = 0; a[i] != 0; i++) - if (a[i] == '/') // Unix-to-DOS style - a[i] = '\\'; +HTS_UNUSED static char* file_convert(char *dest, size_t size, const char *src) { + size_t i; + for(i = 0 ; src[i] != '\0' && i + 1 < size ; i++) { +#ifdef _WIN32 + if (src[i] == '/') { + dest[i] = '\\'; + } else { #endif - return a; -} - -HTS_UNUSED static char *fconcat(char *catbuff, const char *a, const char *b) { - return __fconv(concat(catbuff, a, b)); -} - -HTS_UNUSED static char *fconv(char *catbuff, const char *a) { - return __fconv(concat(catbuff, a, "")); + dest[i] = src[i]; +#ifdef _WIN32 + } +#endif + } + dest[i] = '\0'; + return dest; } #endif |
