Skip to content

Instantly share code, notes, and snippets.

@ShikherVerma
Created July 27, 2017 13:02
Show Gist options
  • Save ShikherVerma/a40e172e7ff3cdc3d430a0d4f427be33 to your computer and use it in GitHub Desktop.
Save ShikherVerma/a40e172e7ff3cdc3d430a0d4f427be33 to your computer and use it in GitHub Desktop.
Example C program. gcc test.c; ./a.out; This verifies that strlen on unsigned char array gives the length of content and not the length of array.
#include <stdio.h>
#include <string.h>
static unsigned char push_cert_sha1[20];
int main() {
printf("Length = %d", strlen(push_cert_sha1));
sprintf(push_cert_sha1, "Hello");
printf("Length = %d", strlen(push_cert_sha1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment