Skip to content

Commit

Permalink
Few LCC memory fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen authored and zturtleman committed Dec 16, 2017
1 parent 7c2dd01 commit 76ec9fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/tools/lcc/cpp/tokens.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ puttokens(Tokenrow *trp)
if (wbp >= &wbuf[OBS]) {
write(1, wbuf, OBS);
if (wbp > &wbuf[OBS])
memcpy(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
memmove(wbuf, wbuf+OBS, wbp - &wbuf[OBS]);
wbp -= OBS;
}
}
Expand Down
4 changes: 3 additions & 1 deletion code/tools/lcc/etc/bytecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ void UpdatePaths( const char *lccBinary )
{
char basepath[ 1024 ];
char *p;
size_t basepathsz = sizeof( basepath ) - 1;

strncpy( basepath, lccBinary, 1024 );
strncpy( basepath, lccBinary, basepathsz );
basepath[basepathsz] = 0;
p = strrchr( basepath, PATH_SEP );

if( p )
Expand Down

0 comments on commit 76ec9fb

Please sign in to comment.