diff options
-rw-r--r-- | file_io/os2/filesys.c | 13 | ||||
-rw-r--r-- | strings/apr_strings.c | 9 | ||||
-rw-r--r-- | threadproc/beos/proc.c | 6 |
3 files changed, 15 insertions, 13 deletions
diff --git a/file_io/os2/filesys.c b/file_io/os2/filesys.c index b323e488d..ef597b38e 100644 --- a/file_io/os2/filesys.c +++ b/file_io/os2/filesys.c @@ -94,12 +94,13 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) { - char path[APR_PATH_MAX]; - - strcpy(path, root); - if (path[1] == ':') - path[0] = apr_toupper(path[0]); - *rootpath = apr_pstrdup(p, path); + if (root[0] && apr_islower(root[0]) && root[1] == ':') { + *rootpath = apr_pstrdup(p, root); + (*rootpath)[0] = apr_toupper((*rootpath)[0]); + } + else { + *rootpath = root; + } return APR_SUCCESS; } diff --git a/strings/apr_strings.c b/strings/apr_strings.c index a88f35e09..384a8c035 100644 --- a/strings/apr_strings.c +++ b/strings/apr_strings.c @@ -429,7 +429,8 @@ APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf) return strcpy(buf, " - "); } if (size < 973) { - sprintf(buf, "%3d ", (int) size); + if (apr_snprintf(buf, 5, "%3d ", (int) size) < 0) + return strcpy(buf, "****"); return buf; } do { @@ -442,12 +443,14 @@ APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf) if (size < 9 || (size == 9 && remain < 973)) { if ((remain = ((remain * 5) + 256) / 512) >= 10) ++size, remain = 0; - sprintf(buf, "%d.%d%c", (int) size, remain, *o); + if (apr_snprintf(buf, 5, "%d.%d%c", (int) size, remain, *o) < 0) + return strcpy(buf, "****"); return buf; } if (remain >= 512) ++size; - sprintf(buf, "%3d%c", (int) size, *o); + if (apr_snprintf(buf, 5, "%3d%c", (int) size, *o) < 0) + return strcpy(buf, "****"); return buf; } while (1); } diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index ff6ac1e0d..d733de138 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -114,12 +114,10 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, const char *dir) { char * cwd; - if (strncmp("/",dir,1) != 0 ) { + if (dir[0] != '/') { cwd = (char*)malloc(sizeof(char) * PATH_MAX); getcwd(cwd, PATH_MAX); - strncat(cwd,"/\0",2); - strcat(cwd,dir); - attr->currdir = (char *)apr_pstrdup(attr->pool, cwd); + attr->currdir = (char *)apr_pstrcat(attr->pool, cwd, "/", dir, NULL); free(cwd); } else { attr->currdir = (char *)apr_pstrdup(attr->pool, dir); |