mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 15:32:43 +02:00
azbox: terminate string in video/proc_get
Origin commit data
------------------
Branch: master
Commit: ab2140161a
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-06-23 (Sat, 23 Jun 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -89,8 +89,12 @@ static int proc_get(const char *path, char *value, const int len)
|
||||
return pfd;
|
||||
ret = read(pfd, value, len);
|
||||
value[len-1] = '\0'; /* make sure string is terminated */
|
||||
if (ret >= 0)
|
||||
{
|
||||
while (ret > 0 && isspace(value[ret-1]))
|
||||
value[--ret] = '\0'; /* remove trailing whitespace */
|
||||
ret--; /* remove trailing whitespace */
|
||||
value[ret] = '\0'; /* terminate, even if ret = 0 */
|
||||
}
|
||||
ret2 = close(pfd);
|
||||
if (ret2 < 0)
|
||||
return ret2;
|
||||
|
Reference in New Issue
Block a user