Hi, sshd crashes at below location. After compilation, when I start sshd it crashes in ?sshbuf-misc.c? file inside ?sshbuf_b64tod? function at line size_t plen = strlen(b64); The call trace is as below, Sshd main function -> sshkey_load_public -> sshkey_try_load_public -> sshkey_read -> sshbuf_b64tod During compilation a warning is thrown. Is this the trigger point for the crash? "sshkey.c", : warning #2223-D: function "strndup" declared implicitly if ((blobcopy = strndup(cp, space)) == NULL) Please help me to resolve this issue. Thank you. -- *With Best Regards* *Shivakumar S*
Hi, please, can anyone tell me why I'm getting this error? how to resolve this error? Thanks and Regards Shivakumar On Mon, Feb 17, 2020 at 11:37 AM shiva kumar <shivakumar2696 at gmail.com> wrote:> Hi, > sshd crashes at below location. > After compilation, when I start sshd it crashes in ?sshbuf-misc.c? file > inside ?sshbuf_b64tod? function at line size_t plen = strlen(b64); > > The call trace is as below, > Sshd main function -> sshkey_load_public -> sshkey_try_load_public -> > sshkey_read -> sshbuf_b64tod > > During compilation a warning is thrown. Is this the trigger point for the > crash? > "sshkey.c", : warning #2223-D: function "strndup" declared implicitly > if ((blobcopy = strndup(cp, space)) == NULL) > > Please help me to resolve this issue. > > Thank you. > > -- > *With Best Regards* > *Shivakumar S* >-- *With Best Regards* *Shivakumar S*
On Mon, 17 Feb 2020 at 17:17, shiva kumar <shivakumar2696 at gmail.com> wrote:> sshd crashes at below location. > After compilation, when I start sshd it crashes in ?sshbuf-misc.c? file > inside ?sshbuf_b64tod? function at line size_t plen = strlen(b64); > > The call trace is as below, > Sshd main function -> sshkey_load_public -> sshkey_try_load_public -> > sshkey_read -> sshbuf_b64tod > > During compilation a warning is thrown. Is this the trigger point for the > crash? > "sshkey.c", : warning #2223-D: function "strndup" declared implicitly > if ((blobcopy = strndup(cp, space)) == NULL)It's possible. It'll be implicitly declared to return an int and if that's a different size to your char * the return value will be truncated. What platform is this? Does it have a native strndup (ie is HAVE_STRNDUP defined in config.h)? If so, which header file is strndup defined in? -- Darren Tucker (dtucker at dtucker.net) GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
yes, the problem was with the HAVE_STRNDUP flag in config.h. it is working now. thank you. Regards Shivakumar On Mon, Feb 17, 2020 at 2:16 PM Darren Tucker <dtucker at dtucker.net> wrote:> On Mon, 17 Feb 2020 at 17:17, shiva kumar <shivakumar2696 at gmail.com> > wrote: > > sshd crashes at below location. > > After compilation, when I start sshd it crashes in ?sshbuf-misc.c? file > > inside ?sshbuf_b64tod? function at line size_t plen = strlen(b64); > > > > The call trace is as below, > > Sshd main function -> sshkey_load_public -> sshkey_try_load_public -> > > sshkey_read -> sshbuf_b64tod > > > > During compilation a warning is thrown. Is this the trigger point for the > > crash? > > "sshkey.c", : warning #2223-D: function "strndup" declared implicitly > > if ((blobcopy = strndup(cp, space)) == NULL) > > It's possible. It'll be implicitly declared to return an int and if > that's a different size to your char * the return value will be > truncated. > > What platform is this? Does it have a native strndup (ie is > HAVE_STRNDUP defined in config.h)? If so, which header file is > strndup defined in? > > -- > Darren Tucker (dtucker at dtucker.net) > GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860 37F4 9357 ECEF 11EA A6FA (new) > Good judgement comes with experience. Unfortunately, the experience > usually comes from bad judgement. >-- *With Best Regards* *Shivakumar S*