Re: TextBuffer Help



Andreas Stricker a écrit :
Hi

Maybe you should try sprintf() instead of printf() to format and write
the gint into a string,


I can't understand that people still propose the use of
sprintf/strcpy etc. This function are responsible for most
buffer overflows in code. I've spend weeks to remove the use
of this functions in crappy code.

oops, sorry, you're 120% right. I forgot the "n" between "s" and
"printf". But using glib is even better. (I just answered a bit too
quickly to the question).


glib provide much better an easier functions (g_strdup_printf,
g_snprintf etc.).

If you like to use char arrays without glib, then please use
the "n" versions snprintf() and strncpy().


My 2 cents

Andreas Stricker


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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