[OpenSIPS-Devel] [OpenSIPS/opensips] 480102: Migrate tcp conn ID from int to unsigned int

Bogdan Andrei IANCU noreply at github.com
Tue Jun 15 15:50:26 EST 2021


  Branch: refs/heads/3.1
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 48010230ae03f409be7919708cd67c2e7cc589cd
      https://github.com/OpenSIPS/opensips/commit/48010230ae03f409be7919708cd67c2e7cc589cd
  Author: Bogdan-Andrei Iancu <bogdan at opensips.org>
  Date:   2021-06-15 (Tue, 15 Jun 2021)

  Changed paths:
    M forward.c
    M forward.h
    M ip_addr.h
    M modules/proto_bin/proto_bin.c
    M modules/proto_hep/proto_hep.c
    M modules/proto_sctp/sctp_server.c
    M modules/proto_sctp/sctp_server.h
    M modules/proto_smpp/proto_smpp.c
    M modules/proto_tls/proto_tls.c
    M modules/proto_ws/proto_ws.c
    M modules/proto_wss/proto_wss.c
    M net/api_proto.h
    M net/net_tcp.c
    M net/net_tcp.h
    M net/proto_tcp/proto_tcp.c
    M net/proto_udp/proto_udp.c
    M net/tcp_conn_defs.h

  Log Message:
  -----------
  Migrate tcp conn ID from int to unsigned int

As used to generate array indexes (for tcp partitions), the ID of the TCP conn must be a positive number.
Still it was initialized with rand() (so possible high valules) and continously incremented -> this may lead to an overflow, resulting into a negative value (for an int data type).
The solution was to move to unsigned int, so we are safe when overflowing (still resutling into a positive number)
Fixes #2344

(cherry picked from commit 6a89cb8eb1f62578a71fa43353c564a7ea69c685)





More information about the Devel mailing list