mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
Fix a buffer error.
This commit is contained in:
parent
fb65cd2b44
commit
3337dc609f
1 changed files with 5 additions and 2 deletions
|
@ -175,7 +175,7 @@ scanFile
|
||||||
- (void) scanFile: (NSString *)filename
|
- (void) scanFile: (NSString *)filename
|
||||||
{
|
{
|
||||||
int size, line;
|
int size, line;
|
||||||
const char *data;
|
char *data;
|
||||||
const char *fname;
|
const char *fname;
|
||||||
id cl;
|
id cl;
|
||||||
int i;
|
int i;
|
||||||
|
@ -190,7 +190,9 @@ scanFile
|
||||||
if (!contents)
|
if (!contents)
|
||||||
return;
|
return;
|
||||||
size = [contents length];
|
size = [contents length];
|
||||||
data = (const char *) [contents bytes];
|
data = malloc (size + 1);
|
||||||
|
memcpy (data, [contents bytes], size);
|
||||||
|
data[size] = 0;
|
||||||
|
|
||||||
line = 1;
|
line = 1;
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < size; i++) {
|
||||||
|
@ -204,6 +206,7 @@ scanFile
|
||||||
line++;
|
line++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue