diff --git a/linphone/coreapi/lpconfig.c b/linphone/coreapi/lpconfig.c
index f513ad9dfc649100ceb07f2b92a95ca02e404d00..13021a3775949bb2c44f1253e5be649b8514c4d1 100644
--- a/linphone/coreapi/lpconfig.c
+++ b/linphone/coreapi/lpconfig.c
@@ -185,7 +185,7 @@ void lp_config_parse(LpConfig *lpconfig){
 					
 					pos1++;
 					pos2=strchr(pos1,'\n');
-					if (pos2==NULL) pos2=pos1+strlen(pos2);
+					if (pos2==NULL) pos2=pos1+strlen(pos1);
 					else {
 						*pos2='\0'; /*replace the '\n' */
 						pos2--;