C Security Pre Function

Slides:



Advertisements
Similar presentations
Computer Programming w/ Eng. Applications
Advertisements

Making Choices in C if/else statement logical operators break and continue statements switch statement the conditional operator.
C Characters & Strings Character Review Character Handling Library Initialization String Conversion Functions String Handling Library Standard Input/Output.
 2000 Prentice Hall, Inc. All rights reserved Fundamentals of Strings and Characters String declarations –Declare as a character array or a variable.
By Senem Kumova Metin 1 POINTERS + ARRAYS + STRINGS REVIEW.
CS1061 C Programming Lecture 10: Macros, Casting and Intro. to Standard Library A. O’Riordan, 2004.
1 Introduction to Computers and Programming Class 3 Introduction to C Professor Avi Rosenfeld.
Testing a program Remove syntax and link errors: Look at compiler comments where errors occurred and check program around these lines Run time errors:
C Programming. Chapter – 1 Introduction Study Book for one month – 25% Learning rate Use Compiler for one month – 60%
Operators in Python. Arithmetic operators Some operators in Python will look familiar (+, -, *, /) Others are new to you (%, //, **) All of these do work.
How to start Visual Studio 2008 or 2010 (command-line program)
Lecture 2: Introduction to C Programming. OBJECTIVES In this lecture you will learn:  To use simple input and output statements.  The fundamental data.
File IO and command line input CSE 2451 Rong Shi.
CSCE 548 Integer Overflows Format String Problem.
1 IS 2150 / TEL 2810 Introduction to Security James Joshi Associate Professor, SIS Lecture 12.2 Nov 20, 2012 Integer Issues.
CSCI 130 More on Arrays. Multi-dimensional Arrays Multi - Dimensional arrays: –have more than one subscript –can be directly initialized –can be initialized.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
C is a high level language (HLL)
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
NOTE: C programs consist of functions one of which must be main. C programs consist of functions one of which must be main. Every C program begins executing.
7. BASIC TYPES. Systems of numeration Numeric Types C’s basic types include integer types and floating types. Integer types can be either signed or unsigned.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
CSC 482/582: Computer Security
Secure Coding Rules for C++ Copyright © 2016 Curt Hill
Lesson #5 Repetition and Loops.
Formatted Input/Output
INC 161 , CPE 100 Computer Programming
Jonathan C.L. Liu, Ph.D. CISE Department University of Florida, USA
Chapter 2 - Introduction to C Programming
Lesson #5 Repetition and Loops.
REPETITION STATEMENTS
Exercises on String Operations
Chapter 2 - Introduction to C Programming
Secure Coding Rules for C++ Copyright © Curt Hill
Formatted Input/Output
Programming in C Input / Output.
Chapter 08- printf and scanf
Formatted Input/Output
Some Basics for Problem Analysis and Solutions
Introduction to the C Language
توابع ورودي-خروجي.
Formatted Input/Output
Lesson #5 Repetition and Loops.
INPUT & OUTPUT scanf & printf.
Functions I Creating a programming with small logical units of code.
CSCE 206 Lab Structured Programming in C
A function with one argument
Program Breakdown, Variables, Types, Control Flow, and Input/Output
Conversion Check your class notes and given examples at class.
Exercise Solution First questions What's output What's input
Examples Example Problems, their Algorithms, and their C Source Code.
Formatted Input/Output
Formatted Input/Output
Introduction to C Programming
CSC 253 Lecture 2.
Formatted Input/Output
EECE.2160 ECE Application Programming
Lesson #5 Repetition and Loops.
Character Arrays char string1[] = “first”;
Assignment Operators Topics Increment and Decrement Operators
CSCE 206 Lab Structured Programming in C
CS31 Discussion 1D Winter19: week 4
C Characters and Strings
Functions I Creating a programming with small logical units of code.
Incremental Programming
CSCE 206 Lab Structured Programming in C
Files Chapter 8.
Getting Started With Coding
Introduction to C Programming
Presentation transcript:

C Security Pre Function Pepper

Standards The CERT C Secure Coding Standard CSC270 is Not testing on these Familiarity Sometimes without the reason

Avoid Single Argument Printf When you are just printing one line without any variables, use one of the following: puts (string); (the \n will be appended) printf(“%s”, string); Ex bad: printf(“hello\n”); Ex good: puts(“hello”); printf(“%s”, “hello”);

Arithmetic Overflow Sum = integer1 + integer2 can yield a number too large for an integer. <limits.h> holds INT_MAX and INT_MIN Check before calculating Unsigned ints: UNIT_MAX from <limits.h> trap negative entries

Scanf’s return value If input fails (wrong type), returns EOF (defined in <stdio.h>) If it succeeds, it returns the number of variables read Check that the number read is successful Also validate range