Re: [PATCH] rpc.idmapd: Sections in idmapd.conf are ignored.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Steve Dickson wrote:

  In the parsing routine, conf_parse_line(), a string
  is not being null terminated which is causing
  section of the config file to be ignored.
  
  https://bugzilla.linux-nfs.org/show_bug.cgi?id=205
  
  Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
  ---
   support/nfs/conffile.c |    3 ++-
   1 files changed, 2 insertions(+), 1 deletions(-)
  
  diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
  index fa0dc6b..3990578 100644
  --- a/support/nfs/conffile.c
  +++ b/support/nfs/conffile.c
  @@ -256,13 +256,14 @@ conf_parse_line(int trans, char *line, size_t sz)
   			val++, j++;
   		if (*val)
   			i = j;
  -		section = malloc(i);
  +		section = malloc(i+1);
   		if (!section) {
   			xlog_warn("conf_parse_line: %d: malloc (%lu) failed", ln,
   						(unsigned long)i);
   			return;
   		}
   		strncpy(section, line, i);
  +		section[i] = '\0';
   
   		if (arg) 
   			free(arg);

Use of strdup() would not only make the code simpler but would eliminate the
possibility of introducing this kind of bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux