Menu

#2029 incorrect retval type used for socket API resulting in internal error

v3.x
open
nobody
None
2024-07-06
2024-05-11
No

Several functions in src/socket.c use a size_t to contain the return value from socket API calls, where they (on linux at least) should be ssize_t (error is signaled with -1).
In vice_network_send(), this may generate the error "vice_network_send: internal error" if the socket is closed by the client during a send.

An additional anomaly is that when this happens during a remote monitor session, it will loop with this message indefinitely, probably due to the condition not being checked correctly further down.

Discussion

  • Daniel Kahlin

    Daniel Kahlin - 2024-05-11

    src/monitor/monitor_network.c: monitor_network_transmit() casts this back from int to size_t again, not sure where it ends up.

     
  • Daniel Kahlin

    Daniel Kahlin - 2024-05-11

    Starting vice with x64sc -default -remotemonitor -remotemonitoraddress ip4://127.0.0.1:6510 and then doing echo -en 'help\n\x03\n' | nc localhost 6510 followed by a manual ctrl-C seems to trigger the condition in vice_network_send().

     
  • gpz

    gpz - 2024-07-06

    @compyx is this fixed now?

     
  • Daniel Kahlin

    Daniel Kahlin - 2024-07-06

    There was a rewrite of the return value types. The actual symptom reporter here remains however.

     

Log in to post a comment.