mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[c-host] correct buffer size for stncat
This commit is contained in:
parent
6d6034870e
commit
1475845675
@ -82,8 +82,8 @@ int main(int argc, char * argv[])
|
|||||||
// get the device size
|
// get the device size
|
||||||
{
|
{
|
||||||
char file[100] = "/sys/class/uio/";
|
char file[100] = "/sys/class/uio/";
|
||||||
strncat(file, params.shmDevice , sizeof(file));
|
strncat(file, params.shmDevice , sizeof(file) - 1);
|
||||||
strncat(file, "/maps/map0/size", sizeof(file));
|
strncat(file, "/maps/map0/size", sizeof(file) - 1);
|
||||||
|
|
||||||
int fd = open(file, O_RDONLY);
|
int fd = open(file, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@ -109,7 +109,7 @@ int main(int argc, char * argv[])
|
|||||||
// open the device
|
// open the device
|
||||||
{
|
{
|
||||||
char file[100] = "/dev/";
|
char file[100] = "/dev/";
|
||||||
strncat(file, params.shmDevice, sizeof(file));
|
strncat(file, params.shmDevice, sizeof(file) - 1);
|
||||||
app.shmFD = open(file, O_RDWR, (mode_t)0600);
|
app.shmFD = open(file, O_RDWR, (mode_t)0600);
|
||||||
app.shmMap = MAP_FAILED;
|
app.shmMap = MAP_FAILED;
|
||||||
if (app.shmFD < 0)
|
if (app.shmFD < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user