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

Bogdan Andrei IANCU noreply at github.com
Fri Apr 16 11:41:31 EST 2021


  Branch: refs/heads/master
  Home:   https://github.com/OpenSIPS/opensips
  Commit: 6a89cb8eb1f62578a71fa43353c564a7ea69c685
      https://github.com/OpenSIPS/opensips/commit/6a89cb8eb1f62578a71fa43353c564a7ea69c685
  Author: Bogdan-Andrei Iancu <bogdan at opensips.org>
  Date:   2021-04-16 (Fri, 16 Apr 2021)

  Changed paths:
    M forward.c
    M forward.h
    M ip_addr.h
    M modules/proto_bin/proto_bin.c
    M modules/proto_bins/proto_bins.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





More information about the Devel mailing list