| ▲ | swinglock 20 hours ago | |||||||
I'm surprised curlx_strcopy doesn't return success. Sure you could check if dest[0] != '/0' if you care to, but that's not only clumsy to write but also error prone, and so checking for success is not encouraged. | ||||||||
| ▲ | jutter 20 hours ago | parent | next [-] | |||||||
This is especially bizarre given that he explains above that "it is rare that copying a partial string is the right choice" and that the previous solution returned an error... So now it silently fails and sets dest to an empty string without even partially copying anything!? | ||||||||
| ▲ | ahoka 11 hours ago | parent | prev | next [-] | |||||||
Yeah, thought the same. Expect some CVEs in the future. | ||||||||
| ▲ | AlexeyBrin 20 hours ago | parent | prev | next [-] | |||||||
I guess the idea is that if the code does not crash at this line:
it means it succeeded. Although some compilers will remove the assertions in release builds.I would have preferred an explicit error code though. | ||||||||
| ||||||||
| ▲ | 7 hours ago | parent | prev [-] | |||||||
| [deleted] | ||||||||