Ticket #10223: 0001-Fixed-possible-not-null-termined-strings.patch

File 0001-Fixed-possible-not-null-termined-strings.patch, 1.3 KB (added by Ezodev, 6 years ago)
  • src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp

    From a829e7034246db47d884fdfbe840bbdc912e945b Mon Sep 17 00:00:00 2001
    From: Ezo <ezo.dev@gmail.com>
    Date: Tue, 19 Nov 2013 17:38:44 +0000
    Subject: [PATCH] Fixed possible not null-termined strings
    
    ---
     src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp | 8 +++++---
     1 file changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp b/src/add-ons/kernel/drivers/graphics/radeon_hd/radeon_hd.cpp
    index 8c9e69a..6ab3be9 100644
    a b radeon_hd_init(radeon_info &info) 
    645645    info.shared_info->dceMinor = info.dceMinor;
    646646    info.shared_info->registers_area = info.registers_area;
    647647    strncpy(info.shared_info->deviceName,
    648         info.deviceName, MAX_NAME_LENGTH);
     648        info.deviceName, MAX_NAME_LENGTH-1);
     649    info.shared_info->deviceName[MAX_NAME_LENGTH-1] = NULL;
    649650    strncpy(info.shared_info->chipsetName,
    650         radeon_chip_name[info.chipsetID], MAX_NAME_LENGTH);
    651 
     651        radeon_chip_name[info.chipsetID], MAX_NAME_LENGTH-1);
     652    info.shared_info->chipsetName[MAX_NAME_LENGTH-1] = NULL;
     653   
    652654    // *** AtomBIOS mapping
    653655    // First we try an active bios read
    654656    status_t biosStatus = radeon_hd_getbios(info);