On Thu, Sep 05, 2002 at 02:50:26PM +0200, Martin Sj?gren wrote:
> tor 2002-09-05 klockan 02.31 skrev Michael Cardenas:
> > +void passwd_callback( GtkWidget *widget,
> > +                     GtkWidget *entry )
> > +{
> > +  const char *entrytext;
> > +  entrytext = gtk_entry_get_text (GTK_ENTRY (entry));
> > +  
> > +  gPassword = malloc(strlen(entrytext));
> > +  strcpy(gPassword, entrytext);
> 
> Why not just strdup?

...and the original allocates one byte too few; it needs an
extra byte for the NUL-terminator.

Matt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to