Re: [PATCH] PGP/GPG support for Balsa 1.3.5



Am 26.04.02 10:01:44 schrieb(en) Brian Stafford:
[snip]
> Using strcpy is fundamentally unsafe as it does not check that there is 
> enough room in the destination buffer.  It is particularly to be avoided 
> in "secure" code.  (I had my wrists smacked for this henious crime 
> recently.)
[snip]

Agree -- and that's a good reason for *exclusively* using the string 
routines from libglib (which we include anyway in any gnome/gtk 
application). The one to use in this case is g_strndup. From the docs:

gchar* g_strndup(const gchar *str, guint n);
Duplicates the first n characters of a string, and null-terminates it. If 
str is NULL, NULL is returned. The returned string should be freed when no 
longer needed.

See http://developer.gnome.org/doc/API/glib/ for more...

Cheers, Albrecht.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Albrecht Dreß  -  Johanna-Kirchner-Straße 13  -  D-53123 Bonn (Germany)
        Phone (+49) 228 6199571  -  mailto:albrecht.dress@arcor.de
_________________________________________________________________________



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