alpine 3.6
misc weakness #248

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.

 					sizeof(kgkey) - 1);
			} else {
				lprintf(LOG_WARN, "Unable to read kgkey from environment");
			}
			break;
		case 'y':
			memset(kgkey, 0, sizeof(kgkey));

			rc = ipmi_parse_hex(optarg, kgkey, sizeof(kgkey) - 1);
			if (rc == -1) {
				lprintf(LOG_ERR, "Number of Kg key characters is not even");
				goto out_free;
			} else if (rc == -3) {
				lprintf(LOG_ERR, "Kg key is not hexadecimal number");
				goto out_free;
			} else if (rc > (IPMI_KG_BUFFER_SIZE-1)) {
				lprintf(LOG_ERR, "Kg key is too long");
				goto out_free;
			}
			break;
		case 'Y':
#ifdef HAVE_GETPASSPHRASE
			tmp_pass = getpassphrase("Key: ");
#else
			tmp_pass = getpass("Key: ");
#endif
			if (tmp_pass != NULL) {
				memset(kgkey, 0, sizeof(kgkey));
				strncpy((char *)kgkey, tmp_pass,
					sizeof(kgkey) - 1);
				tmp_pass = NULL;
			}
			break;
		case 'U':
			if (username) {
				free(username);
				username = NULL;
			}
			if (strlen(optarg) > 16) {
				lprintf(LOG_ERR, "Username is too long (> 16 bytes)");
				goto out_free;
			}
			username = strdup(optarg);
			if (username == NULL) {
				lprintf(LOG_ERR, "%s: malloc failure", progname);
				goto out_free;
			}
			break;
		case 'S':
			if (sdrcache) { 

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.