Skip to content

Instantly share code, notes, and snippets.

matt@ults:~/c$ ll
total 12
drwxrwxr-x 2 matt matt 4096 Apr 25 12:49 ./
drwxr-xr-x 23 matt matt 4096 Apr 25 12:49 ../
-rw-rw-r-- 1 matt matt 1828 Apr 25 12:45 elementCount.c
matt@ults:~/c$ gcc elementCount.c -o elementCount
matt@ults:~/c$ ll
total 24
drwxrwxr-x 2 matt matt 4096 Apr 25 12:49 ./
drwxr-xr-x 23 matt matt 4096 Apr 25 12:49 ../
#include <stdio.h>
#include <string.h>
#include <wchar.h>
/*
* Modified example to demonstrate a potential buffer overflow
* in the secure code example provided by Carnegie Mellon.
*
* Original URL: https://www.securecoding.cert.org/confluence/display/seccode/ARR38-C.+Guarantee+that+library+functions+do+not+form+invalid+pointers
* Section: Compliant Solution (Element Count)

Keybase proof

I hereby claim:

  • I am mattpresson on github.
  • I am matt_presson (https://keybase.io/matt_presson) on keybase.
  • I have a public key whose fingerprint is 806A D588 A36C B714 32D7 0FF1 43B3 1A90 ADA3 A1A7

To claim this, I am signing this object:

[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (MembershipService.ValidateUser(model.UserName, model.Password))
{
FormsService.SignIn(model.UserName, model.RememberMe);
if (!String.IsNullOrEmpty(returnUrl))
{