1 /* Adapted from https://samate.nist.gov/SARD/test-cases/117/versions/1.0.0
2 Part of https://samate.nist.gov/SARD/test-suites/81
4 Black, P. , Koo, H. and Irish, T. (2013), A Basic CWE-121 Buffer Overflow Effectiveness Test Suite, Proc. 6th Latin-American Symposium on Dependable Computing, Rio de Janeiro, -1, [online], https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=913117 (Accessed January 17, 2023)
7 /* Taxonomy Classification: 0000000000000000000100 */
13 * MEMORY LOCATION 0 stack
17 * INDEX COMPLEXITY 0 constant
18 * ADDRESS COMPLEXITY 0 constant
19 * LENGTH COMPLEXITY 0 N/A
20 * ADDRESS ALIAS 0 none
22 * LOCAL CONTROL FLOW 0 none
23 * SECONDARY CONTROL FLOW 0 none
25 * LOOP COMPLEXITY 0 N/A
28 * RUNTIME ENV. DEPENDENCE 0 no
30 * CONTINUOUS/DISCRETE 0 discrete
37 Permission is hereby granted, without written agreement or royalty fee, to use,
38 copy, modify, and distribute this software and its documentation for any
39 purpose, provided that the above copyright notice and the following three
40 paragraphs appear in all copies of this software.
42 IN NO EVENT SHALL M.I.T. BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
43 INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE
44 AND ITS DOCUMENTATION, EVEN IF M.I.T. HAS BEEN ADVISED OF THE POSSIBILITY OF
47 M.I.T. SPECIFICALLY DISCLAIMS ANY WARRANTIES INCLUDING, BUT NOT LIMITED TO
48 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
51 THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND M.I.T. HAS NO OBLIGATION TO
52 PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
56 int main(int argc
, char *argv
[])
62 buf
[10] = 'A'; /* { dg-warning "stack-based buffer overflow" } */
63 /* { dg-message "write of 1 byte to beyond the end of 'buf'" "note" { target *-*-* } .-1 } */