This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blah blah |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Examples of various error handling mechanisms and if-statements. | |
| def something(x,y): | |
| if !x: | |
| raise "argh!" | |
| else: | |
| if !y: | |
| raise "oh noes!" | |
| else: | |
| return "Happy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Checking silc tookit for bad string functions using: | |
| egrep -r '[^_.>a-zA-Z0-9](str(n?cpy|n?cat|xfrm|n?dup|str|pbrk|tok|_)|stpn?cpy|a?sn?printf|byte_)' . | |
| Result is below. Not great but about 300 is a manageable target to audit and improve. | |
| ./contrib/regexpr.c: strcpy(buf, "end"); | |
| ./contrib/regexpr.c: strcpy(buf, "bol"); | |
| ./contrib/regexpr.c: strcpy(buf, "eol"); | |
| ./contrib/regexpr.c: strcpy(buf, "set "); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| from urlparse import urlparse | |
| def cors(func): | |
| def add_basic_headers(resp, url): | |
| resp['Access-Control-Allow-Origin'] = url.scheme + "://" + url.netloc | |
| resp['Access-Control-Allow-Credentials'] = 'true' | |
| resp['Access-Control-Allow-Methods'] = 'GET' | |
| resp['Access-Control-Allow-Headers'] = 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' |
NewerOlder