Exploring Python tools and features

The first activity that we carried out in this module was to explore python tools and featured which we had to do in codio

Part 1

In this example, you will compile and run a program in C using the Codio workspace provided (Buffer Overflow in C). The program is already provided as bufoverflow.c - a simple program that creates a buffer and then asks you for a name, and prints it back out to the screen.

Running the above code with 8 characters or less, you get the following output;

Running the same code with over 8 characters, you get the code following output;

When you run the program, it prints the output and then it also prints the message above. This message comes because the program is writing in the memory that is not allocated to it and therefore it crashed.

Part II

Carrying out a comparison of the c code with one in Python (Buffer Overflow in Python) below:

We get the output below

Comparing this output to the one that was in C, it is observed that for Python, code is checked and once a potential issue is observed, the code is terminated immediately while for C the code was executed before noting the buffer issue.

Installing pylint and run pylint Overflow.py; we got the following output;

  • Module Artefacts

    Phone

    +265 888 208 986

    Address

    National TB Program
    Private Bag 65
    Lilongwe, Malawi