strlen returns incorrect value when called in gdb
- by alesplin
So I'm noticing some severely incorrect behavior from calls to standard library functions inside GDB. I have the following program to illustrate:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *s1 = "test";
char *s2 = calloc(strlen("test")+1,sizeof(char));
…