mirror of
				https://github.com/alsa-project/alsa-tools.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	hdspmixer: Fix buffer overflow
A one off string buffer overflow fixed by handling it properly with string stream. Signed-off-by: Georg Rudolph <georg.rudolph@schwaben.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									0de8b19562
								
							
						
					
					
						commit
						6af3047947
					
				
					 2 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
					@ -25,9 +25,9 @@ HDSPMixerIOMixer::HDSPMixerIOMixer(int x, int y, int w, int h, int ch, int type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    mixer_type = type;
 | 
					    mixer_type = type;
 | 
				
			||||||
    if (type) {
 | 
					    if (type) {
 | 
				
			||||||
	sprintf(channel_name, "Out %d", ch);
 | 
						channel_name << "Out " << ch;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
	sprintf(channel_name, "In %d", ch);
 | 
						channel_name << "In " << ch;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    channel_num = ch;
 | 
					    channel_num = ch;
 | 
				
			||||||
    if (channel_num%2) {
 | 
					    if (channel_num%2) {
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ void HDSPMixerIOMixer::draw()
 | 
				
			||||||
	draw_background();
 | 
						draw_background();
 | 
				
			||||||
	fl_color(FL_BLACK);
 | 
						fl_color(FL_BLACK);
 | 
				
			||||||
	fl_font(FL_HELVETICA, 8);
 | 
						fl_font(FL_HELVETICA, 8);
 | 
				
			||||||
	fl_draw(channel_name, x()+4, y()+225, 27, 9, FL_ALIGN_CENTER);
 | 
						fl_draw(channel_name.str().c_str(), x()+4, y()+225, 27, 9, FL_ALIGN_CENTER);
 | 
				
			||||||
	for (int i=children(); i--;) {
 | 
						for (int i=children(); i--;) {
 | 
				
			||||||
	    Fl_Widget& o = **a++;
 | 
						    Fl_Widget& o = **a++;
 | 
				
			||||||
	    draw_child(o);
 | 
						    draw_child(o);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,7 @@
 | 
				
			||||||
#include "HDSPMixerStripData.h"
 | 
					#include "HDSPMixerStripData.h"
 | 
				
			||||||
#include "HDSPMixerMeter.h"
 | 
					#include "HDSPMixerMeter.h"
 | 
				
			||||||
#include "pixmaps.h"
 | 
					#include "pixmaps.h"
 | 
				
			||||||
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class HDSPMixerWindow;
 | 
					class HDSPMixerWindow;
 | 
				
			||||||
class HDSPMixerSelector;
 | 
					class HDSPMixerSelector;
 | 
				
			||||||
| 
						 | 
					@ -52,7 +53,7 @@ class HDSPMixerIOMixer:public Fl_Group
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    char **p_iomixer_xpm;
 | 
					    char **p_iomixer_xpm;
 | 
				
			||||||
    int channel_num, relative_num, mixer_type;
 | 
					    int channel_num, relative_num, mixer_type;
 | 
				
			||||||
    char channel_name[6];
 | 
						std::stringstream channel_name;
 | 
				
			||||||
    void update_child(Fl_Widget &widget);
 | 
					    void update_child(Fl_Widget &widget);
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    HDSPMixerStripData *data[3][3][8]; /* data[card][mode(ss/ds/qs)][preset number] */
 | 
					    HDSPMixerStripData *data[3][3][8]; /* data[card][mode(ss/ds/qs)][preset number] */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue