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

Bogdan Andrei IANCU noreply at github.com
Tue Jun 15 16:02:56 EST 2021


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

  Changed paths:
    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_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)
(cherry picked from commit 48010230ae03f409be7919708cd67c2e7cc589cd)





More information about the Devel mailing list