VirtualBox

Changeset 83235 in vbox


Ignore:
Timestamp:
Mar 9, 2020 8:49:17 AM (5 years ago)
Author:
vboxsync
Message:

VBoxService: Use strncmp rather than strcmp as the ut_user field is only zero terminated if the username has shorter than the size of the field (from the utmp manpage)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r82968 r83235  
    607607            bool fFound = false;
    608608            for (uint32_t i = 0; i < cUsersInList && !fFound; i++)
    609                 fFound = strcmp(papszUsers[i], ut_user->ut_user) == 0;
     609                fFound = strncmp(papszUsers[i], ut_user->ut_user, sizeof(ut_user->ut_user)) == 0;
    610610
    611611            if (!fFound)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette