summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-15 19:33:38 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-15 19:33:38 +0000
commit638cc96917f28a99fe9c4fb0ab0a93b16058e8bf (patch)
tree8f54764d00f942e5b9180f15f7e81e0d008460a0
parentc6e0ad4bced6c6f2072c880de4ad9e46a4c27981 (diff)
Added some asserts for Android.
-rw-r--r--src/htslib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/htslib.c b/src/htslib.c
index 08297bf..b7eccdd 100644
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -4412,8 +4412,10 @@ HTSEXT_API char *hts_rootdir(char *file) {
strc.path[0] = '\0';
strc.init = 1;
if (strnotempty(file)) {
+ const size_t file_len = strlen(file);
char *a;
+ assertf(file_len < sizeof(strc.path));
strcpybuff(strc.path, file);
while((a = strrchr(strc.path, '\\')))
*a = '/';
@@ -4423,7 +4425,7 @@ HTSEXT_API char *hts_rootdir(char *file) {
strc.path[0] = '\0';
}
if (!strnotempty(strc.path)) {
- if (getcwd(strc.path, 1024) == NULL)
+ if (getcwd(strc.path, sizeof(strc.path)) == NULL)
strc.path[0] = '\0';
else
strcatbuff(strc.path, "/");