diff options
| author | Marc G. Fournier <scrappy@FreeBSD.org> | 1996-05-26 20:28:05 +0000 |
|---|---|---|
| committer | Marc G. Fournier <scrappy@FreeBSD.org> | 1996-05-26 20:28:05 +0000 |
| commit | bcb0ec3dcd00d697c3bfc49aa4e9714cc446bcf5 (patch) | |
| tree | 5c335997a64e3db7ce932852789004c5a1273577 /games | |
| parent | 7439849253160f0c9895b742c4f70f66c0e4b375 (diff) | |
Notes
Diffstat (limited to 'games')
| -rw-r--r-- | games/quiz/quiz.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index aa5f52783e6f1..25ee3ed5f544b 100644 --- a/games/quiz/quiz.c +++ b/games/quiz/quiz.c @@ -316,11 +316,14 @@ appdstr(s, tp, len) if ((m = malloc(strlen(s) + len + 1)) == NULL) err("%s", strerror(errno)); for (mp = m, sp = s; *mp++ = *sp++;); + mp--; if (*(mp - 1) == '\\') --mp; - while ((ch = *mp++ = *tp++) && ch != '\n'); - *mp = '\0'; + memcpy(mp, tp, len); + mp[len] = '\0'; + if (mp[len - 1] == '\n') + mp[len - 1] = '\0'; free(s); return (m); |
