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

Re: segmentation fault



LATER:

the initial error from telnetd is normal, and expected, and generated
from line 306 from keytab_file.c

306		krb5_set_error_string(context, "open(%s): %s", d->filename,
(gdb) print ret

this is because I forget the generate an /etc/krb5.keytab file for
this computer (I am not certain what to do here yet, as this is a
laptop, and its IP address may vary...).

however, the following code appears to discard the error, and replaces
it with an out of memory error:

    if (ret) {
        free (ed);
        free (c->data);
        c->data = NULL;
        krb5_set_error_string (context, "malloc: out of memory");
        return ENOMEM;
    }

furthermore, as my stack trace shows, this call to
krb5_set_error_string fails.

I can't see why krb5_set_error_string causes a segmentation fault, as
everything looks OK to me.

all variables are defined:

(gdb) print context->error_string
$3 = 0x8066ec8 "open(/etc/krb5.keytab): No such file or directory"

krb5_vset_error_string (context=0x8065710, 
    fmt=0x4004187e "malloc: out of memory", args=0xbffff98c)
    at error_string.c:75

All it does is (simplified):

free(context->error_string);
vasprintf(&context->error_string, fmt, args);

the segmentation fault occurs in the vasprintf.
-- 
Brian May <bam@snoopy.apana.org.au>