* Re: [Powertop] [PATCH v2] Fix string null termination and SIGABRT from glibc
@ 2012-09-26 17:13 Chris Ferron
0 siblings, 0 replies; 3+ messages in thread
From: Chris Ferron @ 2012-09-26 17:13 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]
On 09/26/2012 07:19 AM, Sergey Senozhatsky wrote:
> On (09/26/12 16:12), Mikko Rapeli wrote:
>> According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
>> the string is not null terminated when too much data is read.
>>
>> This patch fixes the crashes on my system.
>> ---
>> src/process/process.cpp | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
> LGTM, thanks!
>
> -ss
>
Your patch has been merged.
Thank You
-C
>> diff --git a/src/process/process.cpp b/src/process/process.cpp
>> index 71f81b6..34dc68d 100644
>> --- a/src/process/process.cpp
>> +++ b/src/process/process.cpp
>> @@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
>>
>> process::process(const char *_comm, int _pid, int _tid) : power_consumer()
>> {
>> - char line[4096];
>> + char line[4097];
>> ifstream file;
>>
>> strcpy(comm, _comm);
>> @@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) : power_consumer()
>> file.open(line);
>> while (file) {
>> file.getline(line, 4096);
>> + line[4096] = '\0';
>> if (strstr(line, "Tgid")) {
>> char *c;
>> c = strchr(line, ':');
>> --
>> 1.7.10.4
>>
>> _______________________________________________
>> PowerTop mailing list
>> PowerTop(a)lists.01.org
>> https://lists.01.org/mailman/listinfo/powertop
>>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [Powertop] [PATCH v2] Fix string null termination and SIGABRT from glibc
@ 2012-09-26 14:19 Sergey Senozhatsky
0 siblings, 0 replies; 3+ messages in thread
From: Sergey Senozhatsky @ 2012-09-26 14:19 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
On (09/26/12 16:12), Mikko Rapeli wrote:
> According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
> the string is not null terminated when too much data is read.
>
> This patch fixes the crashes on my system.
> ---
> src/process/process.cpp | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
LGTM, thanks!
-ss
> diff --git a/src/process/process.cpp b/src/process/process.cpp
> index 71f81b6..34dc68d 100644
> --- a/src/process/process.cpp
> +++ b/src/process/process.cpp
> @@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
>
> process::process(const char *_comm, int _pid, int _tid) : power_consumer()
> {
> - char line[4096];
> + char line[4097];
> ifstream file;
>
> strcpy(comm, _comm);
> @@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) : power_consumer()
> file.open(line);
> while (file) {
> file.getline(line, 4096);
> + line[4096] = '\0';
> if (strstr(line, "Tgid")) {
> char *c;
> c = strchr(line, ':');
> --
> 1.7.10.4
>
> _______________________________________________
> PowerTop mailing list
> PowerTop(a)lists.01.org
> https://lists.01.org/mailman/listinfo/powertop
>
^ permalink raw reply [flat|nested] 3+ messages in thread* [Powertop] [PATCH v2] Fix string null termination and SIGABRT from glibc
@ 2012-09-26 14:12 Mikko Rapeli
0 siblings, 0 replies; 3+ messages in thread
From: Mikko Rapeli @ 2012-09-26 14:12 UTC (permalink / raw)
To: powertop
[-- Attachment #1: Type: text/plain, Size: 943 bytes --]
According to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=682388
the string is not null terminated when too much data is read.
This patch fixes the crashes on my system.
---
src/process/process.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/process/process.cpp b/src/process/process.cpp
index 71f81b6..34dc68d 100644
--- a/src/process/process.cpp
+++ b/src/process/process.cpp
@@ -86,7 +86,7 @@ static void cmdline_to_string(char *str)
process::process(const char *_comm, int _pid, int _tid) : power_consumer()
{
- char line[4096];
+ char line[4097];
ifstream file;
strcpy(comm, _comm);
@@ -103,6 +103,7 @@ process::process(const char *_comm, int _pid, int _tid) : power_consumer()
file.open(line);
while (file) {
file.getline(line, 4096);
+ line[4096] = '\0';
if (strstr(line, "Tgid")) {
char *c;
c = strchr(line, ':');
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-26 17:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-26 17:13 [Powertop] [PATCH v2] Fix string null termination and SIGABRT from glibc Chris Ferron
-- strict thread matches above, loose matches on Subject: below --
2012-09-26 14:19 Sergey Senozhatsky
2012-09-26 14:12 Mikko Rapeli
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.