Notes on C Flashcards

1
Q

What are the advantages?

A
  • Efficient
  • Fast
  • Low-level capabilities
  • Portable
    These features improve performance and give more control to the programmer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the disadvantages?

A

Safety checks are not enforced
- Bounds checking
- Type safety checking
- Range checking
Programmer responsible for memory and resource management
Due to the amount of control given programmer requires a good deal of care, knowledge and skill

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Size of data types

A

char: 8 bits
short int: 16 bits
int: 32 bits
long int: 64 bits
float: 32
double: 64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the integer security vulnerabilities?

A

Casting issues (converting from bigger to smaller data type or between incompatible types)
Integer overflow (value of integer goes beyond the maximum or minimum value resulting in the value being wrapped around the other end of the allowed range)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the array security vulnerabilities?

A

Bounds checking (no built-in out-of-bounds checks for arrays, vulnerable to overflow)
Determining array size (using sizeof() when a raise out of scope will return standard pointer size, logical error)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the string security vulnerabilities?

A

Dangerous string functions (no bounds checking or length restriction)
Off-by-one/null-termination

How well did you know this?
1
Not at all
2
3
4
5
Perfectly