Skip to content

Commit

Permalink
Fix dogfight map07 shotgun bullet
Browse files Browse the repository at this point in the history
Fix possible buffer overflow
  • Loading branch information
cxong committed Jul 21, 2016
1 parent 70bf1ef commit 8663f8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dogfights/map07.cdogscpn/bullets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"Name": "sshotgun",
"Pic": {
"Type": "Normal",
"Sprites": "bullet_ball"
"Pic": "bullet_ball"
},
"Speed": 1280,
"Range": 30,
Expand Down
5 changes: 5 additions & 0 deletions src/cdogs/blit.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,11 @@ void BlitMasked(
int isTransparent)
{
Uint32 *current = pic->Data;
if (current == NULL)
{
CASSERT(false, "unexpected NULL pic data");
return;
}
const Uint32 maskPixel = COLOR2PIXEL(mask);
int i;
pos = Vec2iAdd(pos, pic->offset);
Expand Down
2 changes: 1 addition & 1 deletion src/cdogs/pic_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ static void MaybeAddStyleName(
return;
}
const char *nextSlash = strchr(picName + strlen(prefix), '/');
char buf[CDOGS_FILENAME_MAX];
char buf[CDOGS_PATH_MAX];
const size_t len = nextSlash - picName - strlen(prefix);
strncpy(buf, picName + strlen(prefix), len);
buf[len] = '\0';
Expand Down

0 comments on commit 8663f8d

Please sign in to comment.