SSP fortification macros

ASSI via Cygwin-apps <[email protected]>
Newsgroups gmane.os.cygwin.applications
Message-ID <[email protected]>
These seem to be imported from NetBDS, but these crap out when using certain
C99 and up features due to their lack of protecting their arguments, so
this code:

--8<---------------cut here---------------start------------->8---
	memcpy(ed.md5, (unsigned char[]) {
		0xfe, 0xed, 0xfe, 0xed, 0xfe, 0xed, 0xfe, 0xed, 0xfe, 0xed,
		0xfe, 0xed, 0xfe, 0xed, 0xfe, 0xed,
	}, sizeof(ed.md5));
--8<---------------cut here---------------end--------------->8---

will go boom like that:

--8<---------------cut here---------------start------------->8---
/mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/libarchive/test/test_write_format_mtree_preset_digests.c: In function ‘test_write_format_mtree_digests_md5_digest_set_no_data’:
/mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/libarchive/test/test_write_format_mtree_preset_digests.c:332:26: error: macro "memcpy" passed 19 arguments, but takes just 3
  332 |         }, sizeof(ed.md5));
      |                          ^
In file included from /usr/include/string.h:180,
                 from /mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/test_utils/test_common.h:73,
                 from /mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/libarchive/test/test.h:42,
                 from /mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/libarchive/test/test_write_format_mtree_preset_digests.c:26:
/usr/include/ssp/string.h:97: note: macro "memcpy" defined here
   97 | #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
      | 
/mnt/share/cygpkgs/libarchive/libarchive.x86_64/src/libarchive-3.8.0/libarchive/test/test_write_format_mtree_preset_digests.c:329:9: warning: statement with no effect [-Wunused-value]
  329 |         memcpy(ed.md5, (unsigned char[]) {
      |         ^~~~~~
--8<---------------cut here---------------end--------------->8---

If there is a version of these macros compatible with Cygwin that avoids
the issue it would be nice to replace or update them.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.