diff --git a/arrToBin.c b/arrToBin.c index 95480d0..8fa42bd 100644 --- a/arrToBin.c +++ b/arrToBin.c @@ -21,7 +21,6 @@ int main(){ bin[i] = b; } for(int j = 0; j < 16; j++){ - if( printf("%d", bin[j]); } printf("\n"); diff --git a/bin/7-teiler b/bin/7-teiler index 34a678a..b140f42 100755 Binary files a/bin/7-teiler and b/bin/7-teiler differ diff --git a/bin/7teiler b/bin/7teiler index 1d7b37a..fbcb6ab 100755 Binary files a/bin/7teiler and b/bin/7teiler differ diff --git a/bin/abc b/bin/abc new file mode 100755 index 0000000..d3bb158 Binary files /dev/null and b/bin/abc differ diff --git a/bin/adder b/bin/adder index e19edf5..5e39703 100755 Binary files a/bin/adder and b/bin/adder differ diff --git a/bin/args b/bin/args index 820fca2..a7e68bf 100755 Binary files a/bin/args and b/bin/args differ diff --git a/bin/arrToBin b/bin/arrToBin new file mode 100755 index 0000000..0deafc7 Binary files /dev/null and b/bin/arrToBin differ diff --git a/bin/ascii b/bin/ascii index 90dad55..48d1bb8 100755 Binary files a/bin/ascii and b/bin/ascii differ diff --git a/bin/calculator b/bin/calculator index c32eeb4..0532a62 100755 Binary files a/bin/calculator and b/bin/calculator differ diff --git a/bin/callreference b/bin/callreference index e3a1a22..ef22d0c 100755 Binary files a/bin/callreference and b/bin/callreference differ diff --git a/bin/complex b/bin/complex index d1c20c7..bd65b20 100755 Binary files a/bin/complex and b/bin/complex differ diff --git a/bin/echo b/bin/echo index ce19f57..aab6123 100755 Binary files a/bin/echo and b/bin/echo differ diff --git a/bin/echochar b/bin/echochar index 2455112..a4dcf34 100755 Binary files a/bin/echochar and b/bin/echochar differ diff --git a/bin/euler b/bin/euler index 8394326..aaa2c6b 100755 Binary files a/bin/euler and b/bin/euler differ diff --git a/bin/factorial b/bin/factorial index 37d2cf7..846865b 100755 Binary files a/bin/factorial and b/bin/factorial differ diff --git a/bin/fail b/bin/fail index 1f8ed41..d1870bb 100755 Binary files a/bin/fail and b/bin/fail differ diff --git a/bin/fread b/bin/fread index bdd5260..9982c7f 100755 Binary files a/bin/fread and b/bin/fread differ diff --git a/bin/hello-world b/bin/hello-world index 5a5e3b4..7c58e0b 100755 Binary files a/bin/hello-world and b/bin/hello-world differ diff --git a/bin/options b/bin/options index a4fefca..a6c7ac3 100755 Binary files a/bin/options and b/bin/options differ diff --git a/bin/pointer-arithmetic b/bin/pointer-arithmetic index 4cd2010..035208b 100755 Binary files a/bin/pointer-arithmetic and b/bin/pointer-arithmetic differ diff --git a/bin/pointermagic b/bin/pointermagic index 652da0a..02a2360 100755 Binary files a/bin/pointermagic and b/bin/pointermagic differ diff --git a/bin/primenumbers b/bin/primenumbers index b7910ae..4278733 100755 Binary files a/bin/primenumbers and b/bin/primenumbers differ diff --git a/bin/quersumme b/bin/quersumme index ddbd5c2..0285516 100755 Binary files a/bin/quersumme and b/bin/quersumme differ diff --git a/bin/readfile b/bin/readfile index b9f4712..c2209a6 100755 Binary files a/bin/readfile and b/bin/readfile differ diff --git a/bin/redefinition b/bin/redefinition index 5d35564..29116b9 100755 Binary files a/bin/redefinition and b/bin/redefinition differ diff --git a/bin/redefinition-if b/bin/redefinition-if index ca6de8e..b69b4d2 100755 Binary files a/bin/redefinition-if and b/bin/redefinition-if differ diff --git a/bin/return-specified b/bin/return-specified index 406b9d4..d860bc7 100755 Binary files a/bin/return-specified and b/bin/return-specified differ diff --git a/bin/scanf-test b/bin/scanf-test index f9a18f0..ac23d91 100755 Binary files a/bin/scanf-test and b/bin/scanf-test differ diff --git a/bin/scnaf-hex-test b/bin/scnaf-hex-test index 63669dd..f5cb2e0 100755 Binary files a/bin/scnaf-hex-test and b/bin/scnaf-hex-test differ diff --git a/bin/signed-to-unsigned b/bin/signed-to-unsigned index 6684e2d..988e7a8 100755 Binary files a/bin/signed-to-unsigned and b/bin/signed-to-unsigned differ diff --git a/bin/sizeofs b/bin/sizeofs index e4b4f63..8abe52c 100755 Binary files a/bin/sizeofs and b/bin/sizeofs differ diff --git a/bin/success b/bin/success index 4fc9eb4..6442220 100755 Binary files a/bin/success and b/bin/success differ diff --git a/bin/sum b/bin/sum index f85bb80..a47e9d8 100755 Binary files a/bin/sum and b/bin/sum differ diff --git a/bin/tabtest b/bin/tabtest index 2b28928..aa8bbe0 100755 Binary files a/bin/tabtest and b/bin/tabtest differ diff --git a/bin/umlaut b/bin/umlaut index 0ab933f..f7f9025 100755 Binary files a/bin/umlaut and b/bin/umlaut differ diff --git a/bin/unary-double-not b/bin/unary-double-not index ca7b6d6..7597fca 100755 Binary files a/bin/unary-double-not and b/bin/unary-double-not differ diff --git a/compile-all.sh b/compile-all.sh index f831cf7..a87e883 100755 --- a/compile-all.sh +++ b/compile-all.sh @@ -1,3 +1,13 @@ #!/bin/bash -echo "compiling all files in working directory $(pwd)" -for file in $(/bin/ls); do ./compile.sh $file; done +returnCode=0 +echo -e "compiling all files in working directory $(pwd)\n" +for file in $(/bin/ls *.c); +do + ./compile.sh $file; + if [ "$?" -ne 0 ] + then + echo -e "\nERROR: could not compile $file !\n"; + returnCode=1; + fi +done +exit $returnCode diff --git a/compile-and-run.sh b/compile-and-run.sh index a79cf6b..ccd5cea 100755 --- a/compile-and-run.sh +++ b/compile-and-run.sh @@ -1,4 +1,4 @@ #!/bin/bash noext=$(echo "$1" | cut -f 1 -d '.') -gcc $1 -o bin/$noext +./compile $1 ./bin/$noext $2 $3 $4 $5 $6 $7 $8 $9 diff --git a/compile.sh b/compile.sh index c0373ff..cfad674 100755 --- a/compile.sh +++ b/compile.sh @@ -1,4 +1,4 @@ #!/bin/bash -echo "compiling $1..." +echo "compiling $1 ..." noext=$(echo "$1" | cut -f 1 -d '.') -gcc $1 -o bin/$noext +gcc $1 -o bin/$noext -lm diff --git a/echo.c b/echo.c index 8278ea0..8a35260 100644 --- a/echo.c +++ b/echo.c @@ -2,7 +2,16 @@ int main() { char s[100]; - gets(s); + //gets(s); + /* + * Never use gets(). Because it is impossible to tell without knowing the data in advance how many characters gets() will read, and be‐ + * cause gets() will continue to store characters past the end of the buffer, it is extremely dangerous to use. It has been used to break + * computer security. Use fgets() instead. + * + * For more information, see CWE-242 (aka "Use of Inherently Dangerous Function") at http://cwe.mitre.org/data/definitions/242.html + * + */ + fgets(s, sizeof(s), stdin); printf("%s\n", s); return 0; }