Skip to content

Commit

Permalink
game: fix possible string overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
IR4T4 committed Dec 2, 2016
1 parent d841852 commit d4bb0bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/game/bg_misc.c
Expand Up @@ -3735,7 +3735,7 @@ void BG_AddPathCorner(const char *name, vec3_t origin)
}

VectorCopy(origin, pathCorners[numPathCorners].origin);
Q_strncpyz(pathCorners[numPathCorners].name, name, 64);
Q_strncpyz(pathCorners[numPathCorners].name, name, MAX_QPATH);
numPathCorners++;
}

Expand Down Expand Up @@ -3781,8 +3781,8 @@ splinePath_t *BG_AddSplinePath(const char *name, const char *target, vec3_t orig

VectorCopy(origin, spline->point.origin);

Q_strncpyz(spline->point.name, name, 64);
Q_strncpyz(spline->strTarget, target ? target : "", 64);
Q_strncpyz(spline->point.name, name, MAX_QPATH);
Q_strncpyz(spline->strTarget, target ? target : "", MAX_QPATH);

spline->numControls = 0;

Expand All @@ -3803,7 +3803,7 @@ void BG_AddSplineControl(splinePath_t *spline, const char *name)
Com_Error(ERR_DROP, "MAX SPLINE CONTROLS (%i) hit", MAX_SPLINE_CONTROLS);
}

Q_strncpyz(spline->controls[spline->numControls].name, name, 64);
Q_strncpyz(spline->controls[spline->numControls].name, name, MAX_QPATH);

spline->numControls++;
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/g_utils.c
Expand Up @@ -67,8 +67,8 @@ void AddRemap(const char *oldShader, const char *newShader, float timeOffset)
}
if (remapCount < MAX_SHADER_REMAPS)
{
strcpy(remappedShaders[remapCount].newShader, newShader);
strcpy(remappedShaders[remapCount].oldShader, oldShader);
Q_strncpyz(remappedShaders[remapCount].newShader, newShader, MAX_QPATH);
Q_strncpyz(remappedShaders[remapCount].oldShader, oldShader, MAX_QPATH);
remappedShaders[remapCount].timeOffset = timeOffset;
remapCount++;
}
Expand Down

0 comments on commit d4bb0bd

Please sign in to comment.