[libgpiod] segfaults in gpiodetect and gpioinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

If a user doesn't have permission, both gpiodetect and gpioinfo
will segfault when run.

$ ./gpiodetect 
gpiochip0 Permission denied
zsh: segmentation fault (core dumped)  ./gpiodetect

The problem is there:
			if (!chip) {
				if (errno == EACCES)
					printf("%s Permission denied\n",
					       entries[i]->d_name);
				else
					die_perror("unable to open %s",
						   entries[i]->d_name);
			}

chip is NULL, but is later dereferenced.

I'm not submitting a fix as there are 2 possibilities that I can see,
and I don't know which one would be best:

  - add a continue after the die_perror line
  - replace the printf above with die_perror()

Regards,
  Frank.



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux