Task #91647 - fixed.err

back to task #91647
download
Error: COMPILER_WARNING:
numad-0.5git/numad.c: scope_hint: In function ‘numad_log’
numad-0.5git/numad.c:150:5: warning[-Wstringop-truncation]: ‘strncpy’ specified bound 1024 equals destination size
#  150 |     strncpy(buf, ctime(&ts), sizeof(buf));
#      |     ^
#  148|       char buf[BUF_SIZE];
#  149|       time_t ts = time(NULL);
#  150|->     strncpy(buf, ctime(&ts), sizeof(buf));
#  151|       char *p = &buf[strlen(buf) - 1];
#  152|       *p++ = ':';

Error: CPPCHECK_WARNING (CWE-476):
numad-0.5git/numad.c:1508: warning[nullPointer]: Possible null pointer dereference: pid_string
# 1506|           snprintf(fname, FNAME_SIZE, "/proc/%d/stat", pid);
# 1507|       } else {
# 1508|->         snprintf(fname, FNAME_SIZE, "/proc/%s/stat", pid_string);
# 1509|       }
# 1510|       int fd = open(fname, O_RDONLY, 0);

Error: COMPILER_WARNING (CWE-758):
numad-0.5git/numad.c: scope_hint: In function ‘main’
numad-0.5git/numad.c:2636:28: warning[-Wrestrict]: passing argument 1 to ‘restrict’-qualified parameter aliases with argument 4
# 2636 |         if (pthread_create(&tid, &attr, &set_dynamic_options, &tid) != 0) {
#      |                            ^~~~                               ~~~~
# 2634|           }
# 2635|           pthread_t tid;
# 2636|->         if (pthread_create(&tid, &attr, &set_dynamic_options, &tid) != 0) {
# 2637|               numad_log(LOG_CRIT, "pthread_create failure: setting thread\n");
# 2638|               exit(EXIT_FAILURE);