Friendica
daniel:// stenberg://
daniel:// stenberg://

daniel:// stenberg://

bagder@mastodon.social

daniel:// stenberg://

bagder@mastodon.social
I write curl. I don't know anything.
ActivityPub
2025-12-28 22:22:55 2025-12-27 22:30:22 2025-12-27 22:30:15 9455177

daniel:// stenberg://
daniel:// stenberg://
mastodon - Link to source

daniel:// stenberg://

1 week ago • •

daniel:// stenberg://

1 week ago • •


strcpy density in #curl source code
a graph showing the strcpy density in the curl source code, going from above 2 per KLOC in the early 2000s to zero in the end of 2025
#curl
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

Kevin
mastodon - Link to source

Kevin

in reply to daniel:// stenberg:// • 1 week ago • •
is it being replaced with strncpy or similar?
  •  Languages
  •  Search Text
  •  Share via ...
in reply to Kevin

daniel:// stenberg://
mastodon - Link to source

daniel:// stenberg://

in reply to Kevin • 1 week ago • •
no, we don't use strncpy() at all either. This is the replacement function: github.com/curl/curl/blob/mast…

curl/lib/curlx/strcopy.c at master · curl/curl

A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP...
GitHub
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

suzune
mastodon - Link to source

suzune

in reply to daniel:// stenberg:// • 1 week ago • •

The memcpy() and mempcpy() functions copy len bytes from string src to string dst. If src and dst overlap, the results are not defined.

Shouldn't there be "restrict" in the function type signature?
en.cppreference.com/w/c/langua…

Otherwise: memmove.

restrict type qualifier (since C99) - cppreference.com

en.cppreference.com
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

bdf2121cc3334b35b6ecda66e471
mastodon - Link to source

bdf2121cc3334b35b6ecda66e471

in reply to daniel:// stenberg:// • 1 week ago • •
interesting, I've always used a BSD-esque truncating strlcpy
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

Oliver Schönrock
mastodon - Link to source

Oliver Schönrock

in reply to daniel:// stenberg:// • 1 week ago • •

Great stuff. What was the motivation here?

performance (ie copying per se), or security (ie replace with strncopy)

  •  Languages
  •  Search Text
  •  Share via ...
in reply to Oliver Schönrock

daniel:// stenberg://
mastodon - Link to source

daniel:// stenberg://

in reply to Oliver Schönrock • 1 week ago • •
@oschonrock to reduce the risk of mistakes, so security pretty much
@Oliver Schönrock
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

mth
mastodon - Link to source

mth

in reply to daniel:// stenberg:// • 1 week ago • •
@oschonrock - looking at the code, this seems to be a hardened version of the original function? Is there a case to include the in the original lib? (Maybe as a new function if there could be backwards compatibility issues)
@Oliver Schönrock
  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

EricJ
mastodon - Link to source

EricJ

in reply to daniel:// stenberg:// • 1 week ago • •

Interesting to see that the graph is not strictly decreasing — meaning that there were commits that added new strcpy() lines as late as this year, despite the projects' review efforts. 🤔

Nonetheless, congrats on reaching 0%. Is there a plan to prevent calls to "bad" functions from sneaking back in again?

  •  Languages
  •  Search Text
  •  Share via ...
in reply to daniel:// stenberg://

xzvf | Peter Bohner
mastodon - Link to source

xzvf | Peter Bohner

in reply to daniel:// stenberg:// • 1 week ago • •
Was this primarily done to reduce the number of AI-slop bugreports, and/or is it genuinely a change for the better?
This entry was edited (1 week ago)
  •  Languages
  •  Search Text
  •  Share via ...
⇧