Given below is my sample code :

```
int function1(unsigned char *out, int length){
unsigned long crypto_out_len = 16;
unsigned char crypto_out[16] = {0};
.......
//produces 16 bytes output & stores in crypto_out
crypto_function(crypto_out, crypto_out_len); 
//lets say crypto_output contents after are : "abcdefghijklmnop"
.......
memcpy(out, crypto_out,length);
return 0;
}

function2(){
unsigned char out[10] = {0};
function1(out, 10);
std::pair<unsigned char *,int> map_entry;
map_entry.first = out;
map_entry.second = 10;
}

```

Now, map\_entry.first should contain : "abcdefghij", right?

But it contains "abcdefghij#$%f1^", some garbage associated with it. How should I avoid such unexpected behaviour so that `map_entry.first` should contain exactly "abcdefghij".