From c281d01c089f4c9410a2756d3bcd99a56f702c86 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 6 Jun 2004 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.10=20-=20Fixed=20some=20default=20paramet?= =?UTF-8?q?ers=20in=20'skincurses'.=20-=20Fixed=20cBitmap::DrawPixel(),=20?= =?UTF-8?q?which=20messed=20with=20other=20bitmaps'=20palettes=20in=20case?= =?UTF-8?q?=20=20=20the=20pixel=20coordinates=20were=20outside=20this=20bi?= =?UTF-8?q?tmap=20(thanks=20to=20Sascha=20Volkenandt=20for=20=20=20reporti?= =?UTF-8?q?ng=20this=20one).=20-=20The=20cBitmap::DrawText()=20function=20?= =?UTF-8?q?now=20doesn't=20set=20any=20background=20pixels=20if=20the=20?= =?UTF-8?q?=20=20given=20background=20color=20is=20clrTransparent.=20This?= =?UTF-8?q?=20allows=20drawing=20"transparent"=20=20=20texts=20(suggested?= =?UTF-8?q?=20by=20Sascha=20Volkenandt).=20-=20The=20cBitmap::SetXpm()=20f?= =?UTF-8?q?unction=20now=20ignores=20unused=20"none"=20color=20entries,=20?= =?UTF-8?q?which=20=20=20some=20broken=20graphics=20tools=20write=20into?= =?UTF-8?q?=20XPM=20files=20(suggested=20by=20Sascha=20Volkenandt).=20-=20?= =?UTF-8?q?No=20longer=20setting=20lnb=20voltage=20if=20the=20frontend=20i?= =?UTF-8?q?s=20not=20DVB-S=20(thanks=20to=20Marco=20=20=20Schl=C3=BC=C3=9F?= =?UTF-8?q?ler).=20-=20Fixed=20displaying=20the=20current=20channel=20when?= =?UTF-8?q?=20switching=20via=20the=20SVDRP=20command=20CHAN=20=20=20(than?= =?UTF-8?q?ks=20to=20J=C3=BCrgen=20Schmitz=20for=20reporting=20this=20one)?= =?UTF-8?q?.=20-=20Fixed=20missing=20audio=20after=20replaying=20a=20DVD?= =?UTF-8?q?=20(thanks=20to=20Marco=20Schl=C3=BC=C3=9Fler).=20-=20Added=20a?= =?UTF-8?q?=20note=20about=20the=20default=20assignment=20of=20the=20color?= =?UTF-8?q?=20keys=20to=20MANUAL.=20-=20Added=20a=20note=20about=20NPTL=20?= =?UTF-8?q?("Native=20Posix=20Thread=20Library")=20to=20the=20INSTALL=20fi?= =?UTF-8?q?le=20=20=20(apparently=20the=20"fix"=20in=20version=201.3.0=20d?= =?UTF-8?q?idn't=20really=20fix=20this).=20-=20Modified=20'libsi'=20to=20r?= =?UTF-8?q?equire=20callers=20to=20state=20the=20buffer=20sizes=20when=20g?= =?UTF-8?q?etting=20=20=20strings=20in=20order=20to=20avoid=20buffer=20ove?= =?UTF-8?q?rflows=20(thanks=20to=20Philip=20Lawatsch=20for=20=20=20debuggi?= =?UTF-8?q?ng=20a=20buffer=20overflow=20in=20eit.c).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libsi/si.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'libsi/si.c') diff --git a/libsi/si.c b/libsi/si.c index 2bc8339..40f9453 100644 --- a/libsi/si.c +++ b/libsi/si.c @@ -6,7 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: si.c 1.10 2004/05/29 17:06:23 kls Exp $ + * $Id: si.c 1.11 2004/06/06 14:43:56 kls Exp $ * * ***************************************************************************/ @@ -206,33 +206,36 @@ bool DescriptorGroup::isComplete() { char *String::getText() { if (getLength() < 0 || getLength() >4095) - return "text error"; + return strdup("text error"); // caller will delete it! char *data=new char(getLength()+1); - decodeText(data); + decodeText(data, getLength()+1); return data; } -char *String::getText(char *buffer) { - if (getLength() < 0 || getLength() >4095) { - strncpy(buffer, "text error", getLength()+1); +char *String::getText(char *buffer, int size) { + if (getLength() < 0 || getLength() >= size) { + strncpy(buffer, "text error", size); + buffer[size-1] = 0; return buffer; } - decodeText(buffer); + decodeText(buffer, size); return buffer; } //taken from VDR, Copyright Klaus Schmidinger -char *String::getText(char *buffer, char *shortVersion) { - if (getLength() < 0 || getLength() >4095) { - strncpy(buffer, "text error", getLength()+1); +char *String::getText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion) { + if (getLength() < 0 || getLength() >= sizeBuffer) { + strncpy(buffer, "text error", sizeBuffer); + buffer[sizeBuffer-1] = 0; + *shortVersion = 0; return buffer; } - decodeText(buffer, shortVersion); + decodeText(buffer, shortVersion, sizeBuffer, sizeShortVersion); return buffer; } //taken from libdtv, Copyright Rolf Hakenes -void String::decodeText(char *buffer) { +void String::decodeText(char *buffer, int size) { const unsigned char *from=data.getData(0); char *to=buffer; @@ -254,11 +257,13 @@ void String::decodeText(char *buffer) { else if (*from == 0x8A) *to++ = '\n'; from++; + if (to - buffer >= size - 1) + break; } *to = '\0'; } -void String::decodeText(char *buffer, char *shortVersion) { +void String::decodeText(char *buffer, char *shortVersion, int sizeBuffer, int sizeShortVersion) { const unsigned char *from=data.getData(0); char *to=buffer; char *toShort=shortVersion; @@ -283,6 +288,8 @@ void String::decodeText(char *buffer, char *shortVersion) { else if (*from == 0x87) IsShortName--; from++; + if (to - buffer >= sizeBuffer - 1 || toShort - shortVersion >= sizeShortVersion - 1) + break; } *to = '\0'; *toShort = '\0'; -- cgit v1.2.3