diff options
author | scrappy <scrappy@FreeBSD.org> | 1996-05-26 20:28:05 +0000 |
---|---|---|
committer | scrappy <scrappy@FreeBSD.org> | 1996-05-26 20:28:05 +0000 |
commit | 6c6210f90be7cbdb15ad15336666874713144a4d (patch) | |
tree | 5c335997a64e3db7ce932852789004c5a1273577 /games | |
parent | abf2e4ca00eae38f5e4fa78ef2bde54a74ac25d2 (diff) | |
download | FreeBSD-src-6c6210f90be7cbdb15ad15336666874713144a4d.zip FreeBSD-src-6c6210f90be7cbdb15ad15336666874713144a4d.tar.gz |
Applied patch to close PR#bin/199
Submitted by: Toshihiro Kanda <candy@kgc.co.jp>
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 aa5f527..25ee3ed 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); |