title: Sending null terminated string to my C code through Python
body: <p>I am sending strings to my BPF C code and I am not sure if the strings passed in are null-terminated. If they are not, is there a way to make them null terminated? I am sending in my lines of code to BPF so I can count them manually using my stringCounter function but I keep hitting a forever loop sadly. Here is what my Python code looks like:</p>
  <pre><code>b = BPF(src_file=&quot;hello.c&quot;)
  
  lookupTable = b[&quot;lookupTable&quot;]
  #add hello.csv to the lookupTable array
  f = open(&quot;hello copy.csv&quot;,&quot;r&quot;)
  contents = f.readlines()
  for i in range(0,len(contents)):
      string = contents[i].encode('utf-8')
      lookupTable[ctypes.c_int(i)] = ctypes.create_string_buffer(string, len(string))
  </code></pre>
  <p>And here is the code I found for my null terminated string counter</p>
  <pre><code>int stringLength(char* txt)
  {
      int i=0,count=0;
      
      while(txt[i++]!='\0'){
          count+=1;
      }
      
      return count;
  }
  </code></pre>