Can someone tell me what I'm doing wrong?

Kenichi Okuyama okuyamak at dd.iij4u.or.jp
Wed May 23 04:31:53 GMT 2001


Dear Ray-san,

>>>>> "RVD" == Ray Van Dolson <rayvd at bludgeon.org> writes:
RVD> Well... I changed this just in case, although it had worked previously
RVD> with this same bit of code... anyways, changed the strncpy line to account
RVD> for \0 and it still segfaults.  sigh... any other suggestions? :)

Because you said so, I believe 

RVD>   strncpy(workgroup,WORKGROUP,8);
RVD> 	strncpy(username,USERNAME,5);
RVD> 	strncpy(password,PASSWORD,0);

are all fixed correctly.


Here comes the next:
2) I don't think this will cause segfault, but just in case...

RVD>   char temp[128];

RVD>   strncpy(workgroup,WORKGROUP,8);

RVD>   if (temp[strlen(temp) - 1] == 0x0a) /* A new line? */
RVD>     temp[strlen(temp) - 1] = 0x00;

I don't understand what you're doing here.
temp[] is only declared, but not being initialized.
so, if you run 'strlen(temp)' you have possibility of segfault.

you have three of them looking alike.
# That's all I found so far.

regards,
---- 
Kenichi Okuyama




More information about the samba-technical mailing list