From bcb0ec3dcd00d697c3bfc49aa4e9714cc446bcf5 Mon Sep 17 00:00:00 2001 From: "Marc G. Fournier" Date: Sun, 26 May 1996 20:28:05 +0000 Subject: [PATCH] Applied patch to close PR#bin/199 Submitted by: Toshihiro Kanda --- games/quiz/quiz.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/games/quiz/quiz.c b/games/quiz/quiz.c index aa5f52783e6f..25ee3ed5f544 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);