cs50 / help.cs50.net

GNU General Public License v3.0
7 stars 5 forks source link

Catch runtime error for out of bounds array access #20

Closed curiouskiwi closed 6 years ago

curiouskiwi commented 6 years ago

Example: Declare a char array: char cipher[strlen(p)]; and then later, try to set cipher[strlen(p)] = '\0' which is one past the end of the array. error: vigenere.c:56:17: runtime error: index 2 out of bounds for type 'char [strlen(p)]'

brianyu28 commented 6 years ago

Actually, this is already handled by the server.

https://github.com/cs50/help50-server/blob/master/helpers/clang.py#L28 https://github.com/cs50/help50-server/blob/master/helpers/clang.py#L548