From patchwork Wed Jan 6 11:11:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 12769 Received: from saarni.dnainternet.net ([83.102.40.136]) by mail.linuxtv.org with esmtp (Exim 4.69) (envelope-from ) id 1NSTnz-0006Of-3b for vdr@linuxtv.org; Wed, 06 Jan 2010 12:11:59 +0100 Received: from localhost (localhost [127.0.0.1]) by saarni.dnainternet.net (Postfix) with ESMTP id C097057EAC for ; Wed, 6 Jan 2010 13:11:22 +0200 (EET) X-Virus-Scanned: DNA Postiturva at dnainternet.net X-Spam-Flag: NO X-Spam-Score: 0.065 X-Spam-Level: X-Spam-Status: No, score=0.065 tagged_above=-9999 required=6 tests=[AWL=0.065] Received: from saarni.dnainternet.net ([83.102.40.136]) by localhost (saarni.dnainternet.net [127.0.0.1]) (amavisd-new, port 10041) with ESMTP id qAjIa1C+XTiw for ; Wed, 6 Jan 2010 13:11:22 +0200 (EET) Received: from omenapuu.dnainternet.net (omenapuu.dnainternet.net [83.102.40.212]) by saarni.dnainternet.net (Postfix) with ESMTP id 9DAEA5783A for ; Wed, 6 Jan 2010 13:11:22 +0200 (EET) Received: from mail.onse.fi (dna23-105.tampere.customers.dnainternet.fi [83.102.23.105]) by omenapuu.dnainternet.net (Postfix) with ESMTP id 95FD82BAE4 for ; Wed, 6 Jan 2010 13:11:22 +0200 (EET) Received: from gamma.onse.fi (gamma [10.0.0.7]) by mail.onse.fi (Postfix) with ESMTP id 34DAE10DE0B8 for ; Wed, 6 Jan 2010 13:11:22 +0200 (EET) From: Anssi Hannula To: vdr@linuxtv.org Date: Wed, 6 Jan 2010 13:11:21 +0200 User-Agent: KMail/1.13.0 (Linux/2.6.32.2-desktop-1mnb; KDE/4.3.85; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201001061311.21633.anssi.hannula@iki.fi> X-LSpam-Score: -2.6 (--) X-LSpam-Report: No, score=-2.6 required=5.0 tests=BAYES_00=-2.599 autolearn=ham Subject: [vdr] [PATCH] fix plugin arguments corruption X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2010 11:11:59 -0000 Status: O X-Status: X-Keywords: X-UID: 21939 VDR uses the construct "strcpy(s, s + 1)" in plugin arguments processing for stripping first character of s. However, as per strcpy man page, the source and destination strings may not overlap. There are a couple of ways to fix them, but the attached patch simply changes them to "memmove(s, s + 1, strlen(s))". The patch applies both to 1.7.10 and 1.6.0. This fixes plugin arguments corruption with glibc 2.11 on x86_64. Index: vdr-1.7.10/plugin.c =================================================================== --- vdr-1.7.10/plugin.c +++ vdr-1.7.10/plugin.c 2010-01-06 12:47:43.396957257 +0200 @@ -172,15 +172,15 @@ static char *SkipQuote(char *s) { char c = *s; - strcpy(s, s + 1); + memmove(s, s + 1, strlen(s)); while (*s && *s != c) { if (*s == '\\') - strcpy(s, s + 1); + memmove(s, s + 1, strlen(s)); if (*s) s++; } if (*s) { - strcpy(s, s + 1); + memmove(s, s + 1, strlen(s)); return s; } esyslog("ERROR: missing closing %c", c); @@ -215,7 +215,7 @@ if (!q) q = p; switch (*p) { - case '\\': strcpy(p, p + 1); + case '\\': memmove(p, p + 1, strlen(p)); if (*p) p++; else {