Changeset 76480 in vbox for trunk/src/VBox/Additions/x11/vboxvideo/getmode.c
- Timestamp:
- Dec 26, 2018 2:12:14 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/getmode.c
r69346 r76480 261 261 void vbvxSetUpLinuxACPI(ScreenPtr pScreen) 262 262 { 263 static const char s_szDevInput[] = "/dev/input/"; 264 struct dirent *pDirent; 265 char szFile[sizeof(s_szDevInput) + sizeof(pDirent->d_name) + 16]; 263 266 VBOXPtr pVBox = VBOXGetRec(xf86Screens[pScreen->myNum]); 264 struct dirent *pDirent;265 267 DIR *pDir; 266 268 int fd = -1; … … 271 273 if (pDir == NULL) 272 274 return; 275 memcpy(szFile, s_szDevInput, sizeof(s_szDevInput)); 273 276 for (pDirent = readdir(pDir); pDirent != NULL; pDirent = readdir(pDir)) 274 277 { … … 276 279 { 277 280 #define BITS_PER_BLOCK (sizeof(unsigned long) * 8) 278 char szFile[64] = "/dev/input/";279 281 char szDevice[64] = ""; 280 282 unsigned long afKeys[KEY_MAX / BITS_PER_BLOCK]; 281 282 strncat(szFile, pDirent->d_name, sizeof(szFile) - sizeof("/dev/input/")); 283 size_t const cchName = strlen(pDirent->d_name); 284 if (cchName + sizeof(s_szDevInput) > sizeof(szFile)) 285 continue; 286 memcpy(&szFile[sizeof(s_szDevInput) - 1], pDirent->d_name, cchName + 1); 283 287 if (fd != -1) 284 288 close(fd);
Note:
See TracChangeset
for help on using the changeset viewer.