Patch: Fix KEncodingProber crashiness
Christoph Feck
christoph at maxiom.de
Fri Mar 20 19:02:39 GMT 2009
Am Friday 20 March 2009 19:25:57 schrieb Jeff Mitchell:
> *Replaces the const char * pointer with a QString on the stack for safety.
> *Replaces a strdup call with a QByteArray and a .data() call, which is not
> strictly necessary but ensures that any safety checks in QByteArray are
> handled.
>
> I'd like to put it in trunk and backport it for 4.2.2.
Who the heck designed this API?
This here does not work, you are returning the address of a temporary,
and the case when d->proper is non zero still uses strdup.
@@ -204,7 +203,7 @@
const char* KEncodingProber::encodingName() const
{
if (!d->prober)
- return strdup("UTF-8");
+ return QByteArray("UTF-8").data();
return strdup(d->prober->GetCharSetName());
}
More information about the kde-core-devel
mailing list