← Commit list

8c1aaf329

Denis Vlasenko
Denis Vlasenko
2007-06-04
FAILED Duration: 11s

Subject

snprintf(... "%s"...) => safe_strncpy

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/libiproute/utils.c+6 -3
@@ -316,9 +316,12 @@ const char *format_host(int af, int len, void *addr, char *buf, int buflen)
default:;
}
}
- if (len > 0 && (h_ent = gethostbyaddr(addr, len, af)) != NULL) {
- snprintf(buf, buflen - 1, "%s", h_ent->h_name);
- return buf;
+ if (len > 0) {
+ h_ent = gethostbyaddr(addr, len, af);
+ if (h_ent != NULL) {
+ safe_strncpy(buf, h_ent->h_name, buflen);
+ return buf;
+ }
}
}
#endif