centos 7
obsolete weakness #271

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

pam_krb5-2.4.8/tests/tools/meanwhile.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 obsolete weakness.

 			memcpy(execs[i], "fork", 4);
			perror(execs[i]);
			break;
		case 0:
			/* Child.  Exec the actual command with the shell's
			 * help. */
			if (verbose) {
				fprintf(stderr, "[%ld] %s\n", (long) getpid(),
					execs[i]);
			}
			execvp(args[0], args);
			return -1;
		default:
			/* Parent. */
			if (readycmds[i] != NULL) {
				for (;;) {
					ret = system(readycmds[i]);
					if (WIFEXITED(ret)) {
						if (WEXITSTATUS(ret) == 0) {
							break;
						}
						if (WEXITSTATUS(ret) == 127) {
							break;
						}
						usleep(100000);
					} else {
						break;
					}
				}
			}
			break;
		}
	}
	/* Run the foreground command. */
	if (verbose) {
		fprintf(stderr, "[%ld] %s\n", (long) getpid(), cmd);
	}
	ret = system(cmd);
	if (verbose) {
		fprintf(stderr, "[%ld] result is %d\n", (long) getpid(), ret);
	}
	/* Clean up the background processes. */
	for (i = 0; i < n_children; i++) {
		if (children[i] == -1) {
			continue;
		}
		status = 0;
		mul = 1;
		sig = SIGTERM;
		while (waitpid(children[i], &status, WNOHANG) != children[i]) { 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.