alpine 3.6
misc weakness #249

4

Weakness Breakdown


Definition:

The software specifies permissions for a security-critical resource in a way that allows the resource to be read or modified by unintended actors.

Warning code(s):

This function is obsolete and not portable. It was in SUSv2 but removed by POSIX.2. What it does exactly varies considerably between systems, particularly in where its prompt is displayed and where it gets its data.

File Name:

ipmitool/src/ipmitool-1.8.18/lib/ipmi_main.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.6 misc weakness.

 			if (hostname) {
				free(hostname);
				hostname = NULL;
			}
			hostname = strdup(optarg);
			if (hostname == NULL) {
				lprintf(LOG_ERR, "%s: malloc failure", progname);
				goto out_free;
			}
			break;
		case 'f':
			if (password) {
				free(password);
				password = NULL;
			}
			password = ipmi_password_file_read(optarg);
			if (password == NULL)
				lprintf(LOG_ERR, "Unable to read password "
						"from file %s", optarg);
			break;
		case 'a':
#ifdef HAVE_GETPASSPHRASE
			tmp_pass = getpassphrase("Password: ");
#else
			tmp_pass = getpass("Password: ");
#endif
			if (tmp_pass != NULL) {
				if (password) {
					free(password);
					password = NULL;
				}
				password = strdup(tmp_pass);
				tmp_pass = NULL;
				if (password == NULL) {
					lprintf(LOG_ERR, "%s: malloc failure", progname);
					goto out_free;
				}
			}
			break;
		case 'k':
			memset(kgkey, 0, sizeof(kgkey));
			strncpy((char *)kgkey, optarg, sizeof(kgkey) - 1);
			break;
		case 'K':
			if ((tmp_env = getenv("IPMI_KGKEY"))) {
				memset(kgkey, 0, sizeof(kgkey));
				strncpy((char *)kgkey, tmp_env,
					sizeof(kgkey) - 1);
			} else {
				lprintf(LOG_WARN, "Unable to read kgkey from environment"); 

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.