const char *laststr = NULL;
for (i = 0; i < (size_t)prog->argc; ++i) {
qcany *str = (qcany*)(prog->globals + OFS_PARM0 + 3*i);
- printf("%s", (laststr = prog_getstring(prog, str->string)));
+ laststr = prog_getstring(prog, str->string);
+ printf("%s", laststr);
}
if (laststr && (prog->xflags & VMXF_TRACE)) {
size_t len = strlen(laststr);
/* use the right NOT_ */
prev = cond;
cond = (ast_expression*)ast_unary_new(ast_ctx(cond), type_not_instr[cond->expression.vtype], cond);
+
+ /*
+ * cppcheck: it thinks there is a possible null pointer dereference
+ * otherwise it would be "redundant" to check it ast_unary_new returned
+ * null, it's wrong.
+ */
if (!cond) {
ast_unref(prev);
parseerror(parser, "internal error: failed to process condition");
* Value will contain a newline character at the end, we need to strip
* this otherwise kaboom, seriously, kaboom :P
*/
- *strrchr(value, '\n')='\0';
+ if (strchr(value, '\n'))
+ *strrchr(value, '\n')='\0';
+ else /* cppcheck: possible nullpointer dereference */
+ abort();
/*
* Now allocate and set the actual value for the specific tag. Which
* Value will contain a newline character at the end, we need to strip
* this otherwise kaboom, seriously, kaboom :P
*/
- *strrchr(value, '\n')='\0';
+ if (strrchr(value, '\n'))
+ *strrchr(value, '\n')='\0';
+ else /* cppcheck: possible null pointer dereference */
+ abort();
vec_push(template->comparematch, util_strdup(value));