Visual Studio Code Analysis shows Warning C6054 -


after running code analysis on solution got, among others, couple of c6054 0 termination missing warnings.

most of them can comprehend , fix following example struggles me bit.

char str[def_len+1];  if(condition) {      memset(str,'\0', def_len+1);      while((strlen(str) + 1 + strlen(strtocat)) <= def_len)     {         strcat(str, "|");         strcat(str, strtocat);     }      strncpy(otherstring, str, def_len); } 

warning 6054: 'str' should zero-terminated may not be

is wrong independent length of strtocat, last byte of str terminated anyway?

is caused strcat or '\0' in memset not recognized 0 termination in context?

the ms help warning tells me set first element in string, helpless obviously, isn't it?

thanks


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -