[Groonga-commit] pgroonga/pgroonga at 77de495 [master] pgroonga_tuple_is_alive(): fix strtol() usage

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 20 23:40:05 JST 2016


Kouhei Sutou	2016-11-20 23:40:05 +0900 (Sun, 20 Nov 2016)

  New Revision: 77de495201644bcb356263a0dee359610ffab0f3
  https://github.com/pgroonga/pgroonga/commit/77de495201644bcb356263a0dee359610ffab0f3

  Message:
    pgroonga_tuple_is_alive(): fix strtol() usage
    
    It requires NUL terminated string.

  Modified files:
    src/pgrn_groonga_tuple_is_alive.c

  Modified: src/pgrn_groonga_tuple_is_alive.c (+2 -3)
===================================================================
--- src/pgrn_groonga_tuple_is_alive.c    2016-11-20 23:35:58 +0900 (4690af2)
+++ src/pgrn_groonga_tuple_is_alive.c    2016-11-20 23:40:05 +0900 (d6daba8)
@@ -13,12 +13,11 @@ static Oid
 sources_table_to_file_node_id(grn_ctx *ctx, grn_obj *table)
 {
 	char name[GRN_TABLE_MAX_KEY_SIZE];
-	char *name_end;
 	int name_size;
 
 	name_size = grn_obj_name(ctx, table, name, GRN_TABLE_MAX_KEY_SIZE);
-	name_end = name + name_size - 1;
-	return strtol(name + PGrnSourcesTableNamePrefixLength, &name_end, 10);
+	name[name_size] = '\0';
+	return strtol(name + PGrnSourcesTableNamePrefixLength, NULL, 10);
 }
 
 static grn_obj *
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index