Skip to content

Commit c851884

Browse files
committed
Unbreak \h; can't do strlen(NULL).
This was broken by the following commmit. Although the original commit was backpatched all the way to 7.4, this particular bug exists only in the version applied to HEAD. http://archives.postgresql.org/pgsql-committers/2010-05/msg00058.php
1 parent 15ab0e9 commit c851884

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/bin/psql/command.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.219 2010/05/08 16:39:51 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.220 2010/05/21 17:37:44 rhaas Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -654,10 +654,14 @@ exec_command(const char *cmd,
654654
size_t len;
655655

656656
/* strip any trailing spaces and semicolons */
657-
len = strlen(opt);
658-
while (len > 0 &&
659-
(isspace((unsigned char) opt[len - 1]) || opt[len - 1] == ';'))
660-
opt[--len] = '\0';
657+
if (opt)
658+
{
659+
len = strlen(opt);
660+
while (len > 0 &&
661+
(isspace((unsigned char) opt[len - 1])
662+
|| opt[len - 1] == ';'))
663+
opt[--len] = '\0';
664+
}
661665

662666
helpSQL(opt, pset.popt.topt.pager);
663667
free(opt);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy