alpine 3.9
obsolete weakness #558

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:

alsa-utils/src/alsa-utils-1.1.8/amidi/amidi.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.9 obsolete weakness.

 }

static int send_midi_interleaved(void)
{
	int err;
	char *data = send_data;
	size_t buffer_size;
	snd_rawmidi_params_t *param;
	snd_rawmidi_status_t *st;

	snd_rawmidi_status_alloca(&st);

	snd_rawmidi_params_alloca(&param);
	snd_rawmidi_params_current(output, param);
	buffer_size = snd_rawmidi_params_get_buffer_size(param);

	while (data < (send_data + send_data_length)) {
		int len = send_data + send_data_length - data;
		char *temp;

		if (data > send_data) {
			snd_rawmidi_status(output, st);
			do {
				/* 320 µs per byte as noted in Page 1 of MIDI spec */
				usleep((buffer_size - snd_rawmidi_status_get_avail(st)) * 320);
				snd_rawmidi_status(output, st);
			} while(snd_rawmidi_status_get_avail(st) < buffer_size);
			usleep(sysex_interval * 1000);
		}

		/* find end of SysEx */
		if ((temp = memchr(data, 0xf7, len)) != NULL)
			len = temp - data + 1;

		if ((err = snd_rawmidi_write(output, data, len)) < 0)
			return err;

		data += len;
	}

	return 0;
}

static void load_file(void)
{
	int fd;
	off_t length;

	fd = open(send_file_name, O_RDONLY);
	if (fd == -1) { 

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.