From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751821AbcGPP6R (ORCPT ); Sat, 16 Jul 2016 11:58:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38815 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbcGPP6N (ORCPT ); Sat, 16 Jul 2016 11:58:13 -0400 Date: Sat, 16 Jul 2016 17:58:08 +0200 From: Jiri Olsa To: Steven Rostedt Cc: Jiri Olsa , Arnaldo Carvalho de Melo , Jiri Pirko , lkml , David Ahern , Ingo Molnar , Namhyung Kim , Peter Zijlstra Subject: Re: [PATCH 1/3] perf script python: Fix string vs byte array resolving Message-ID: <20160716155808.GA16531@krava> References: <1468567797-27564-1-git-send-email-jolsa@kernel.org> <1468567797-27564-2-git-send-email-jolsa@kernel.org> <20160715131840.3a48a0ed@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160715131840.3a48a0ed@gandalf.local.home> User-Agent: Mutt/1.6.2 (2016-07-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 16 Jul 2016 15:58:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 15, 2016 at 01:18:40PM -0400, Steven Rostedt wrote: > On Fri, 15 Jul 2016 09:29:55 +0200 > Jiri Olsa wrote: > > > + if (field->flags & FIELD_IS_STRING && > > + is_printable_array(data + offset, len)) { > > + obj = PyString_FromString((char *) data + offset); > > Hmm. As I stated, It is possible that strings can be non nul > terminated. But I'm looking here and thinking we need to make sure that > it is nul terminated. > > Can PyString_FromString() handle a non nul terminated string? couldn't find in the doc.. but I think it's necessary, there's no other way it could tell the end ;-) I'll make the is_printable_array in case the final 0 is missing thanks, jirka