bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] [PATCH] Buffer Overflow in Keydata::loadPrefix()


From: Gernot Hillier
Subject: [BUG] [PATCH] Buffer Overflow in Keydata::loadPrefix()
Date: Sat, 4 Jan 2003 12:33:27 +0100
User-agent: KMail/1.4.3

Hi!

I stumbled over a very dangerous code part in CommonC++ in the KeyData 
implementation:

void Keydata::loadPrefix(const char *pre, const char *keypath, const char 
*environment)
{
[...]
        if(*keypath == '~')
        {
                prefix = getenv("HOME");
                strcpy(path, prefix); 
                strcat(path, "/.");
                ++keypath;
        }
[...]

This is a classical buffer overflow (use a environment variable, rely on its 
length and copy it to an internal buffer).

I tried to fix it for the time being - but I don't actually know the class as 
I don't use it. Please triple-check my fixes - they're untested and I don't 
have read the complete code of keydata.cpp! 

So please see my patch just as a suggestion. I'll attach it...

-- 
Bye,

Gernot

Attachment: commonc++-bo.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]