1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| | https://gitlab.com/rezozer/forks/sympow/-/merge_requests/5
diff --git a/main.c b/main.c
index 1d018dfc76888790212c7a203154c45b88acb383..0ab1386b5f3a62a79cc08adceb2e3e9553e08a4d 100644
--- a/main.c
+++ b/main.c
@@ -97,7 +97,7 @@ char * dupdirname(const char *name) {
if (eofn!=name) {
const size_t ublofn=eofn-name;
size_t cdx=0; const char * dim=NULL; char * dam=NULL; int flag=0;
- foldername=(char *)(malloc(ublofn)); memset(foldername,'\0',ublofn);
+ foldername=(char *)(malloc(ublofn+1)); memset(foldername,'\0',ublofn+1);
for(cdx=0,dim=name,dam=foldername;cdx<ublofn;++dim,++cdx) {
if (*dim == '/') flag=1;
else {if (flag) {*dam='/'; ++dam; flag=0;} *dam=*dim; ++dam;}}
|