From 638cc96917f28a99fe9c4fb0ab0a93b16058e8bf Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Thu, 15 May 2014 19:33:38 +0000 Subject: Added some asserts for Android. --- src/htslib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/htslib.c') 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, "/"); -- cgit v1.2.3