From kde-commits Sat Dec 07 14:47:43 2002 From: Waldo Bastian Date: Sat, 07 Dec 2002 14:47:43 +0000 To: kde-commits Subject: Re: koffice/krita [POSSIBLY UNSAFE] X-MARC-Message: https://marc.info/?l=kde-commits&m=103927260409568 On Saturday 07 December 2002 05:27, Patrick Julien wrote: > M +282 -105 core/builder/kis_image_magick_converter.cc 1.3 [POSSIBLY > UNSAFE] Are you sure that MaxTextExtent is the proper maximumsize for ii -> filename? Note that man strncpy says: The strncpy() function is similar, except that not more than n bytes of src are copied. Thus, if there is no null byte among the first n bytes of src, the result will not be null-terminated. So I suggest to use: strncpy(ii -> filename, uri.path().latin1(), MaxTextExtent-1); ii -> filename[MaxTextExtent-1] = '\0'; Not security related, but still: strncpy(ii -> filename, uri.path().latin1(), MaxTextExtent-1); should be strncpy(ii -> filename, QFile::encodeName(uri.path()), MaxTextExtent-1); Cheers, Waldo -- bastian@kde.org -=|[ SuSE, The Linux Desktop Experts ]|=- bastian@suse.com