From 6c6210f90be7cbdb15ad15336666874713144a4d Mon Sep 17 00:00:00 2001 From: scrappy Date: Sun, 26 May 1996 20:28:05 +0000 Subject: Applied patch to close PR#bin/199 Submitted by: Toshihiro Kanda --- games/quiz/quiz.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'games') 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); -- cgit v1.1