[Freeipa-devel] [PATCH] create tmp directory for ipa-kpasswd

Dmitri Pal dpal at redhat.com
Fri May 2 14:34:03 UTC 2008


Simo Sorce wrote:
> On Fri, 2008-05-02 at 18:38 +0900, Masato Taruishi wrote:
>   
>> +       tmp_file = (char
>> *)malloc(strlen(cachedir)+strlen(TMP_TEMPLATE)+2);
>>         if (!tmp_file) {
>>                 syslog(LOG_ERR, "Out of memory!");
>>                 ret = KRB5_KPASSWD_HARDERROR;
>>                 goto done;
>>         }
>> +       strcpy( tmp_file, cachedir );
>> +       strcat( tmp_file, "/" );
>> +       strcat( tmp_file, TMP_TEMPLATE );
>>     
>
>
> Change all this with:
> asprintf(&tmp_file, "%s/%s", cachedir, TMP_TEMPLATE);
>
> Simo.
>
>   
This is a non standard extension. If we ever plan to have this code on 
the client that will run on other OSes we should not optimize like this.
If it is server code I agree.

-- 
Dmitri Pal
Engineering Manager
Red Hat Inc. 




More information about the Freeipa-devel mailing list