Mercurial > hg > openttd
comparison src/namegen.cpp @ 10201:6b20fe326959 draft
(svn r14414) -Fix: replace instances of strncpy with strecpy as strncpy doesn't guarantee the resulting string is '\0'-terminated.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Mon, 29 Sep 2008 16:27:02 +0000 |
parents | d48433370037 |
children | 329edc4ee302 |
comparison
equal
deleted
inserted
replaced
10200:23d1dca0aff8 | 10201:6b20fe326959 |
---|---|
34 return SeedChance(shift_by, max + bias, seed) - bias; | 34 return SeedChance(shift_by, max + bias, seed) - bias; |
35 } | 35 } |
36 | 36 |
37 static void ReplaceWords(const char *org, const char *rep, char *buf) | 37 static void ReplaceWords(const char *org, const char *rep, char *buf) |
38 { | 38 { |
39 if (strncmp(buf, org, 4) == 0) strncpy(buf, rep, 4); | 39 if (strncmp(buf, org, 4) == 0) strncpy(buf, rep, 4); // Safe as the string in buf is always more than 4 characters long. |
40 } | 40 } |
41 | 41 |
42 static byte MakeEnglishOriginalTownName(char *buf, uint32 seed, const char *last) | 42 static byte MakeEnglishOriginalTownName(char *buf, uint32 seed, const char *last) |
43 { | 43 { |
44 int i; | 44 int i; |