Skip to content

Commit d822d47

Browse files
committed
Replaces unchecked strcpy/strcat with strlcpy/strlcat
Unchecked strcpy/strcat can result in memory smashes if provided with overly long source arguments. Replacing these with the strl... functions protects against overruns of the destination memory. Requires changing the signature of various functions to pass destination storage size when destination argument is a pointer rather than something amenable to sizeof() operator.
1 parent 7174a0b commit d822d47

File tree

6 files changed

+279
-274
lines changed

6 files changed

+279
-274
lines changed

inc/dirdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ typedef struct dfinfo {
5858
} DFINFO;
5959

6060
#ifdef DOS
61-
int make_old_version(char *old, char *file);
61+
int make_old_version(char *old, size_t oldsize, char *file);
6262
#endif
6363
#ifdef FSDEBUG
6464
void print_finfo(FINFO *fp);

inc/dskdefs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ LispPTR COM_changedir(LispPTR *args);
2121
LispPTR COM_getfreeblock(LispPTR *args);
2222
void conc_dir_and_name(char *dir, char *name, char *fname, size_t fname_size);
2323
void conc_name_and_version(char *name, char *ver, char *rname, size_t rname_size);
24-
void separate_version(char *name, char *ver, int checkp);
24+
void separate_version(char *name, size_t namesize, char *ver, size_t versize, int checkp);
2525
int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp);
26-
int true_name(char *path);
26+
int true_name(char *path, size_t pathsize);
2727
#endif

0 commit comments

Comments
 (0)