VirtualBox

Changeset 100238 in vbox for trunk


Ignore:
Timestamp:
Jun 21, 2023 1:05:35 PM (18 months ago)
Author:
vboxsync
Message:

Shared Clipboard: ShClTransferHttpServerStart() now complies to RFC 6335 (IANA) wrt dynamic port ranges. bugref:9437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-transfers-http.cpp

    r100233 r100238  
    601601
    602602/**
    603  * Starts the Shared Clipboard HTTP server instance using a random port (>= 1024).
     603 * Starts the Shared Clipboard HTTP server instance using a random port (>= 49152).
    604604 *
    605605 * This does automatic probing of TCP ports if a port already is being used.
     
    609609 * @param   cMaxAttempts        Maximum number of attempts to create a HTTP server.
    610610 * @param   puPort              Where to return the TCP port number being used on success. Optional.
     611 *
     612 * @note    Complies with RFC 6335 (IANA).
    611613 */
    612614int ShClTransferHttpServerStart(PSHCLHTTPSERVER pSrv, unsigned cMaxAttempts, uint16_t *puPort)
     
    624626        for (i; i < cMaxAttempts; i++)
    625627        {
    626             /* Try some random ports above 1024 (i.e. "unprivileged ports") -- required, as VBoxClient runs as a user process
    627              * on the guest. */
    628             uPort = RTRandAdvU32Ex(hRand, 1024, UINT16_MAX);
     628            /* Try some random ports >= 49152 (i.e. "dynamic ports", see RFC 6335)
     629             * -- required, as VBoxClient runs as a user process on the guest. */
     630            uPort = RTRandAdvU32Ex(hRand, 49152, UINT16_MAX);
    629631
    630632            /* If the port selected turns is known to be buggy for whatever reason, skip it and try another one. */
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