strncat parameter audit. Unfortunatly, strncat is counter-intutite: the n in

strncat is not the maximum length of the destination string, but of the SOURCE
string, thus strncat (dest, src, sizeof (dest)) is incorrect. It should be
strncat (dest, src, sizeof (text) - strlen (dest)). Even then, no terminating
nul will be written if src is too long, but at least it won't crash the stack:)
This commit is contained in:
Bill Currie 2000-12-05 16:04:12 +00:00
parent 66e0e31b57
commit eae11661e4
19 changed files with 54 additions and 53 deletions

View file

@ -202,12 +202,12 @@ qboolean R_CullBox (vec3_t mins, vec3_t maxs)
void R_RotateForEntity (entity_t *e)
{
glTranslatef (e->origin[0], e->origin[1], e->origin[2]);
glTranslatef (e->origin[0], e->origin[1], e->origin[2]);
glRotatef (e->angles[1], 0, 0, 1);
glRotatef (-e->angles[0], 0, 1, 0);
glRotatef (e->angles[1], 0, 0, 1);
glRotatef (-e->angles[0], 0, 1, 0);
//ZOID: fixed z angle
glRotatef (e->angles[2], 1, 0, 0);
glRotatef (e->angles[2], 1, 0, 0);
}
/*
@ -301,7 +301,7 @@ static void R_DrawSpriteModel (entity_t *e)
right = vright;
}
glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
glEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS);
@ -626,7 +626,7 @@ static void R_DrawAliasModel (entity_t *e)
}
anim = (int)(cl.time*10) & 3;
glBindTexture (GL_TEXTURE_2D, paliashdr->gl_texturenum[currententity->skinnum][anim]);
glBindTexture (GL_TEXTURE_2D, paliashdr->gl_texturenum[currententity->skinnum][anim]);
// we can't dynamically colormap textures, so they are cached
// seperately for the players. Heads are just uncolored.
@ -639,7 +639,7 @@ static void R_DrawAliasModel (entity_t *e)
R_TranslatePlayerSkin(i);
}
if (i >= 0 && i<MAX_CLIENTS)
glBindTexture (GL_TEXTURE_2D, playertextures + i);
glBindTexture (GL_TEXTURE_2D, playertextures + i);
}
if (gl_affinemodels->int_val)
@ -832,7 +832,7 @@ static void R_SetupFrame (void)
static void MYgluPerspective( GLdouble fovy, GLdouble aspect,
GLdouble zNear, GLdouble zFar )
GLdouble zNear, GLdouble zFar )
{
GLdouble xmin, xmax, ymin, ymax;
@ -861,7 +861,7 @@ static void R_SetupGL (void)
// set up viewpoint
//
glMatrixMode(GL_PROJECTION);
glLoadIdentity ();
glLoadIdentity ();
x = r_refdef.vrect.x * glwidth/vid.width;
x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth/vid.width;
y = (vid.height-r_refdef.vrect.y) * glheight/vid.height;
@ -887,22 +887,22 @@ static void R_SetupGL (void)
}
glViewport (glx + x, gly + y2, w, h);
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
screenaspect = (float)r_refdef.vrect.width/r_refdef.vrect.height;
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*180/M_PI;
// yfov = (2.0 * tan (scr_fov->value/360*M_PI)) / screenaspect;
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*(scr_fov->value*2)/M_PI;
// MYgluPerspective (yfov, screenaspect, 4, 4096);
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
// MYgluPerspective (yfov, screenaspect, 4, 4096);
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glLoadIdentity ();
glRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
glRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1], -r_refdef.vieworg[2]);
glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);