halt='use virReportOOMError, not V'IR_ERR_NO_MEMORY \
$(_sc_search_regexp)
+sc_prohibit_PATH_MAX:
+ @prohibit='\<P''ATH_MAX\>' \
+ halt='dynamically allocate paths, do not use P'ATH_MAX \
+ $(_sc_search_regexp)
+
# Use a subshell for each function, to give the optimal warning message.
include $(srcdir)/Makefile.nonreentrant
sc_prohibit_nonreentrant:
* used to subvert the profile */
const char *bad = " /[]*";
- if (strlen(name) == 0 || strlen(name) > PATH_MAX - 1)
+ if (strlen(name) == 0)
return -1;
if (strcspn(name, bad) != strlen(name))
"/sys/devices/pci" /* for hostdev pci devices */
};
- if (path == NULL || strlen(path) > PATH_MAX - 1) {
+ if (path == NULL) {
vah_error(NULL, 0, _("bad pathname"));
return -1;
}
goto free_vol;
}
- if (STREQLEN(devpath, vol->target.path, PATH_MAX) &&
+ if (STREQ(devpath, vol->target.path) &&
!(STREQ(pool->def->target.path, "/dev") ||
STREQ(pool->def->target.path, "/dev/"))) {
/* Extract the source file path*/
if (!(offset = strchr(head, ',')))
goto skipdisk;
- if ((offset - head) >= (PATH_MAX-1))
- goto skipdisk;
if (offset == head) {
disk->src = NULL; /* No source file given, eg CDROM with no media */
const char *tmpdir;
int fd;
- ret = vshMalloc(ctl, PATH_MAX);
-
tmpdir = getenv ("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
- snprintf (ret, PATH_MAX, "%s/virshXXXXXX.xml", tmpdir);
+ if (virAsprintf(&ret, "%s/virshXXXXXX.xml", tmpdir) < 0) {
+ vshError(ctl, "%s", _("out of memory"));
+ return NULL;
+ }
fd = mkstemps(ret, 4);
if (fd == -1) {
vshError(ctl, _("mkstemps: failed to create temporary file: %s"),