azambuja
02-19-2006, 10:34 PM
Hey guys...
First of I'll acknowledge that this question doesn't have much merrit because of the lack of info I have... sorry
Here it is: why would it be acceptable/unacceptable to do this:
char *buf, *gbuf;
int i;
buf=strdup(buf,"goto:/home");
for(i=0;i<(strlen(buf)-5);i++) gbuf[i]=buf[i+5] ; gbuf[i]='\0';
printf("final: %s\n",gbuf);
I can do it in a simple .c program by itself but when I'm trying to change a certain program (enlightenment dr17's efm, if you must know) where it looks to me like it's exactly the same thing it segfaults at the for loop... any possible suggestions of why?
EDIT: doh, I forgot to mention, in the other program when I change *gbuf to gbuf[4096], it works, that's what's driving me mad
NOTE: yes I am a n00b.
Thanks for your time.
First of I'll acknowledge that this question doesn't have much merrit because of the lack of info I have... sorry
Here it is: why would it be acceptable/unacceptable to do this:
char *buf, *gbuf;
int i;
buf=strdup(buf,"goto:/home");
for(i=0;i<(strlen(buf)-5);i++) gbuf[i]=buf[i+5] ; gbuf[i]='\0';
printf("final: %s\n",gbuf);
I can do it in a simple .c program by itself but when I'm trying to change a certain program (enlightenment dr17's efm, if you must know) where it looks to me like it's exactly the same thing it segfaults at the for loop... any possible suggestions of why?
EDIT: doh, I forgot to mention, in the other program when I change *gbuf to gbuf[4096], it works, that's what's driving me mad
NOTE: yes I am a n00b.
Thanks for your time.