News for hackers. Stuff that matters.
Re:Modern C, Second Edition by cma on Thursday September 19, 2019 @12:53AM (#21013398)
Doesn't strcpy always have that issue? The terseness is one issue, but the security problem is that it implements strcpy at all without warning.
Re:Modern C, Second Edition by iamnotacrook on Thursday September 19, 2019 @06:25AM (#21014928)
You tend to get warnings to use the _s versions of some functions (strcpy_s in this case) these days.
Re:Modern C, Second Edition by cesarb on Thursday September 19, 2019 @08:16AM (#21015439)
I just tried (with gcc 9.2.1), and got no warning. As far as I know, these _s versions aren't that good, and often aren't available at all; see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm which says among other things

"[...] none of the popular Open Source distribution such as BSD or Linux has chosen to make either available to their users. At least one (GNU C Library) has repeatedly rejected proposals for inclusion [...]"

"[...] As a result of the numerous deviations from the specification the Microsoft implementation cannot be considered conforming or portable."

Re:Modern C, Second Edition by iamnotacrook on Thursday September 19, 2019 @09:41AM (#21016038)
"often aren't available at all"

It's in C11. Perhaps Red Hat use non-compliant compilers, or very, very old ones?

Re:Modern C, Second Edition by cesarb on Thursday September 19, 2019 @10:54AM (#21016745)
It's an optional part of C11, which means that even a fully compliant compiler does not have to implement them.
Re:Modern C, Second Edition by lone_haxx0r on Thursday September 19, 2019 @07:31PM (#21021779)
strcpy_s has no manual entry on Ubuntu, while "man strcpy" and "man strncpy" work as expected.

Why would that be?