Просмотр исходного кода

Handle NULL ver string in service

In case user not enter ver: in service section, whole
corosync falled with segfaul, because atoi was called
on NULL.

Now, in case of NULL, we rather not use atoi, and
return 0 directly.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2370 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jan Friesse 16 лет назад
Родитель
Сommit
a1db33fc99
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      exec/service.c

+ 1 - 1
exec/service.c

@@ -405,7 +405,7 @@ unsigned int corosync_service_defaults_link_and_init (struct corosync_api_v1 *co
 			(void *)&found_service_ver,
 			(void *)&found_service_ver,
 			NULL);
 			NULL);
 
 
-		found_service_ver_atoi = atoi (found_service_ver);
+		found_service_ver_atoi = (found_service_ver ? atoi (found_service_ver) : 0);
 
 
 		corosync_service_link_and_init (
 		corosync_service_link_and_init (
 			corosync_api,
 			corosync_api,