[alsa-devel] SEGFAULT in ALSA lib 1.0.27.1 pcm_direct parser

Krzysztof Hałasa khalasa at piap.pl
Fri Jun 14 13:59:38 CEST 2013


Hi,

Fixes a segfault when getgrnam_r() returns 0 and still sets pgrp to NULL
when the group simply doesn't exist.

--- alsa-lib/src/pcm/pcm_direct.c	2013-05-21 10:48:28.000000000 +0200
+++ alsa-lib/src/pcm/pcm_direct.c	2013-06-14 13:31:28.981013646 +0200
@@ -1636,7 +1636,7 @@
 				if (buffer == NULL)
 					return -ENOMEM;
 				int st = getgrnam_r(group, &grp, buffer, len, &pgrp);
-				if (st != 0) {
+				if (st != 0 || !pgrp) {
 					SNDERR("The field ipc_gid must be a valid group (create group %s)", group);
 					free(buffer);
 					return -EINVAL;

-- 
Krzysztof Halasa

Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland


More information about the Alsa-devel mailing list