X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=prvm_edict.c;h=67bc940d36d1938ef66297b4484e02320044103a;hp=4baf85d5e26b3f809bafe3723684153b51b29645;hb=49efc53510842f29eccbc160e1aa56c17e575468;hpb=ff46d6ff516fda192c5adc55a5c9b82007545bd2 diff --git a/prvm_edict.c b/prvm_edict.c index 4baf85d5..67bc940d 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -383,7 +383,7 @@ char *PRVM_ValueString (etype_t type, prvm_eval_t *val) switch (type) { case ev_string: - strncpy(line, PRVM_GetString(val->string), sizeof(line)); + strlcpy (line, PRVM_GetString (val->string), sizeof (line)); break; case ev_entity: n = val->edict; @@ -470,7 +470,7 @@ char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val) break; case ev_function: f = pr_functions + val->function; - strncpy(line, PRVM_GetString(f->s_name), sizeof(line)); + strlcpy (line, PRVM_GetString (f->s_name), sizeof (line)); break; case ev_field: def = PRVM_ED_FieldAtOfs ( val->_int ); @@ -595,7 +595,7 @@ void PRVM_ED_Print(prvm_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; @@ -608,7 +608,7 @@ void PRVM_ED_Print(prvm_edict_t *ed) name = PRVM_ValueString(d->type, (prvm_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; @@ -1269,21 +1269,15 @@ void PRVM_LoadProgs (const char * filename, int numrequiredfunc, char **required int i; dstatement_t *st; ddef_t *infielddefs; - void *temp; dfunction_t *dfunctions; Mem_EmptyPool(prog->progs_mempool); Mem_EmptyPool(prog->edictstring_mempool); - temp = FS_LoadFile (filename, false); - if (temp == 0) + prog->progs = (dprograms_t *)FS_LoadFile (filename, prog->progs_mempool, false); + if (prog->progs == NULL) PRVM_ERROR ("PRVM_LoadProgs: couldn't load %s for %s", filename, PRVM_NAME); - prog->progs = (dprograms_t *)Mem_Alloc(prog->progs_mempool, fs_filesize); - - memcpy(prog->progs, temp, fs_filesize); - Mem_Free(temp); - Con_DPrintf("%s programs occupy %iK.\n", PRVM_NAME, fs_filesize/1024); pr_crc = CRC_Block((qbyte *)prog->progs, fs_filesize); @@ -1603,7 +1597,7 @@ void PRVM_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;