This directory contains the learning materials and activities for Week 3 of the Coursera course "Principles of Secure Coding." The activity focuses on modifying a statically implemented queue library to support dynamic size expansion.
fqlib_static.hqlib_static.c
Implemented in the following files:
fqlib_dynamic.hqlib_dynamic.ctest_dynamic.c
Major changes are in qlib_dynamic.c, including the implementation of functions double_queues_size, double_que_size, initialize_queues, and reset_queues. Additionally, the internals of create_queue, put_on_queues, and delete_queues have been modified.
Compile the files using the following command, which includes gdb debug and sanitizer options:
gcc -std=gnu11 -g -fsanitize=address -fsanitize=undefined test_dynamic.c qlib_dynamic.c fqlib_dynamic.h- Array
queues: Each entry contains a pointer to a queue. QUEUE: Contains metadata for a queue and the actual payload.Queue.que: Contains the actual payload input from the user.
Almost no pointers are passed around. Every queue is encapsulated in a ticket, which is the only visible interface to the user. Furthermore, every parameter and return value are checked with thorough scrutiny. This robust approach is inherited from the original static version of the program. Special thanks to Professor Matt Bishop for the demonstration!