Commit 3ab210cb authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Fix a few issues around single-file add argument parsing

Triggered by CID 33630: Unbounded source buffer
parent 4d4059e1
...@@ -729,13 +729,13 @@ int main(int argc, char **argv) ...@@ -729,13 +729,13 @@ int main(int argc, char **argv)
SAFECOPY(fdesc, "no description given"); SAFECOPY(fdesc, "no description given");
} }
sprintf(str,"%s%s", scfg.dir[dirnum]->path, fname); SAFEPRINTF2(str,"%s%s", scfg.dir[dirnum]->path, fname);
if(mode&FILE_DATE) if(mode&FILE_DATE)
sprintf(fdesc, "%s ", unixtodstr(&scfg,(time32_t)fdate(str),tmp)); SAFEPRINTF(fdesc, "%s ", unixtodstr(&scfg,(time32_t)fdate(str),tmp));
if(mode&TODAYS_DATE) else if(mode&TODAYS_DATE)
sprintf(fdesc, "%s ", unixtodstr(&scfg,time32(NULL),tmp)); SAFEPRINTF(fdesc, "%s ", unixtodstr(&scfg,time32(NULL),tmp));
sprintf(tmp, "%.*s", (int)(LEN_FDESC-strlen(fdesc)), argv[++j]); j++;
SAFECOPY(fdesc, tmp); SAFECAT(fdesc, argv[j]);
l=(long)flength(str); l=(long)flength(str);
if(l==-1) { if(l==-1) {
printf("%s not found.\n",str); printf("%s not found.\n",str);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment