X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=pr_edict.c;h=4643f3e44f2510ef850821ff423bb68def1be512;hb=699c77ca2c9fd357fbe479f00e778486becfd840;hp=151e62f0dafaf64bb3357aed577c7a69fabcecbc;hpb=ff46d6ff516fda192c5adc55a5c9b82007545bd2;p=xonotic%2Fdarkplaces.git diff --git a/pr_edict.c b/pr_edict.c index 151e62f0..4643f3e4 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -401,7 +401,7 @@ char *PR_ValueString (etype_t type, eval_t *val) switch (type) { case ev_string: - strncpy(line, PR_GetString(val->string), sizeof(line)); + strlcpy (line, PR_GetString (val->string), sizeof (line)); break; case ev_entity: //n = NoCrash_NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)); @@ -489,7 +489,7 @@ char *PR_UglyValueString (etype_t type, eval_t *val) break; case ev_function: f = pr_functions + val->function; - strncpy(line, PR_GetString(f->s_name), sizeof(line)); + strlcpy (line, PR_GetString (f->s_name), sizeof (line)); break; case ev_field: def = ED_FieldAtOfs ( val->_int ); @@ -614,7 +614,7 @@ void ED_Print(edict_t *ed) if (strlen(name) > 256) { - strncpy(tempstring2, name, 256); + memcpy (tempstring2, name, 256); tempstring2[256] = tempstring2[257] = tempstring2[258] = '.'; tempstring2[259] = 0; name = tempstring2; @@ -627,7 +627,7 @@ void ED_Print(edict_t *ed) name = PR_ValueString(d->type, (eval_t *)v); if (strlen(name) > 256) { - strncpy(tempstring2, name, 256); + memcpy(tempstring2, name, 256); tempstring2[256] = tempstring2[257] = tempstring2[258] = '.'; tempstring2[259] = 0; name = tempstring2; @@ -946,13 +946,12 @@ qboolean ED_ParseEpair(edict_t *ent, ddef_t *key, const char *s) { while (*s && *s <= ' ') s++; - if (!*s) - break; - val->vector[i] = atof(s); + if (*s) + val->vector[i] = atof(s); + else + val->vector[i] = 0; while (*s > ' ') s++; - if (!*s) - break; } break; @@ -1251,7 +1250,6 @@ void PR_LoadProgs (void) int i; dstatement_t *st; ddef_t *infielddefs; - void *temp; dfunction_t *dfunctions; // flush the non-C variable lookup cache @@ -1261,15 +1259,10 @@ void PR_LoadProgs (void) Mem_EmptyPool(progs_mempool); Mem_EmptyPool(edictstring_mempool); - temp = FS_LoadFile ("progs.dat", false); - if (!temp) + progs = (dprograms_t *)FS_LoadFile ("progs.dat", progs_mempool, false); + if (!progs) Host_Error ("PR_LoadProgs: couldn't load progs.dat"); - progs = (dprograms_t *)Mem_Alloc(progs_mempool, fs_filesize); - - memcpy(progs, temp, fs_filesize); - Mem_Free(temp); - Con_DPrintf("Programs occupy %iK.\n", fs_filesize/1024); pr_crc = CRC_Block((qbyte *)progs, fs_filesize); @@ -1543,7 +1536,7 @@ void PR_Fields_f (void) } if (strlen(name) > 256) { - strncpy(tempstring2, name, 256); + memcpy(tempstring2, name, 256); tempstring2[256] = tempstring2[257] = tempstring2[258] = '.'; tempstring2[259] = 0; name = tempstring2;