sprintf and strcpy size safety
This commit is contained in:
parent
63f5977aae
commit
59191c204a
4
obj.c
4
obj.c
@ -497,7 +497,7 @@ static void read_mtl(const char *path,
|
||||
int scanning = 1;
|
||||
int n = 0;
|
||||
|
||||
sprintf(pathname, "%s/%s", path, file);
|
||||
snprintf(pathname, MAXSTR - 1, "%s/%s", path, file);
|
||||
|
||||
if ((fin = fopen(pathname, "r")))
|
||||
{
|
||||
@ -928,7 +928,7 @@ static void read_obj(obj *O, const char *filename)
|
||||
|
||||
/* Extract the directory from the filename for use in MTL loading. */
|
||||
|
||||
strncpy(D, filename, MAXSTR);
|
||||
strncpy(D, filename, MAXSTR - 1);
|
||||
dirpath(D);
|
||||
|
||||
/* Process each line of the OBJ file, invoking the handler for each. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user