diff --git a/config.c b/config.c index a5e950e..0da3502 100644 --- a/config.c +++ b/config.c @@ -33,9 +33,14 @@ int loadConfig(char *str_file, char **str_entry,char **host,int *intervall,int s { char *ptr_host = strrchr(temp_str,'=')+1;//Without = ptr_host[strcspn(ptr_host,"\n")]=0; - while(ptr_host[0]==' ') + while(ptr_host[0]==' ') //Potential segfault?? { - ptr_host = ptr_host + 1; + if(ptr_host < (temp_str + strlen(temp_str))) + { + ptr_host = ptr_host + 1; + }else{ + break; + } } *host = strdup(ptr_host); printf("my host is:%s\n",*host);