alpine 3.9
obsolete weakness #540

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:

dahdi-tools/src/dahdi-tools-2.11.1/fxstest.c

Context:

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

 		if(argc < 4) {	/* user supplied string */
			fprintf(stderr, "You must specify a string of dtmf characters to send\n");
		} else {
			outstring = argv[3];
			if(argc >= 5) {
				sscanf(argv[4], "%30i", &duration);
			}
			printf("Going to send a set of DTMF tones >%s<\n", outstring);
			printf("Using a duration of %d mS per tone\n", duration);
					/* Flush any left remaining characs in the buffer and place the channel into on-hook transfer mode */
			x = DAHDI_FLUSH_BOTH;
			res = ioctl(fd, DAHDI_FLUSH, &x);
			x = 500 + strlen(outstring) * duration;
			ioctl(fd, DAHDI_ONHOOKTRANSFER, &x);

			for (x = 0; '\0' != outstring[x]; x++) {
				dtmftone = digit_to_dtmfindex(outstring[x]);
				if (0 > dtmftone) {
					dtmftone = -1;
				}
				res = tone_zone_play_tone(fd, dtmftone);
				if (res) {
					fprintf(stderr, "Unable to play DTMF tone %d (0x%x)\n", dtmftone, dtmftone);
				}
				usleep(duration * 1000);
			}
		}
	} else if (!strcasecmp(argv[2], "dtmfcid")) {
		char * outstring = "A5551212C";  /* Default string using A and C tones to bracket the number */
		int dtmftone;
		
		if(argc >= 4) {	/* Use user supplied string */
			outstring = argv[3];
		}
		printf("Going to send a set of DTMF tones >%s<\n", outstring);
		/* Flush any left remaining characs in the buffer and place the channel into on-hook transfer mode */
		x = DAHDI_FLUSH_BOTH;
		res = ioctl(fd, DAHDI_FLUSH, &x);
		x = 500 + strlen(outstring) * 100;
		ioctl(fd, DAHDI_ONHOOKTRANSFER, &x);

		/* Play the DTMF tones at a 50 mS on and 50 mS off rate which is standard for DTMF CID spills */
		for (x = 0; '\0' != outstring[x]; x++) {

			dtmftone = digit_to_dtmfindex(outstring[x]);
			if (0 > dtmftone) {
				dtmftone = -1;
			}
			res = tone_zone_play_tone(fd, dtmftone);
			if (res) { 

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.