[Github-comments] [geany/geany] Don't pass NULL to memcpy (PR #2960)

elextr notifications at xxxxx
Thu Nov 25 06:40:24 UTC 2021


@elextr commented on this pull request.



> @@ -694,7 +694,8 @@ static gboolean spawn_async_with_pipes(const gchar *working_directory, const gch
 			for (argc = 0; argv[argc]; argc++);
 
 		full_argv = g_renew(gchar *, cl_argv, cl_argc + argc + 1);
-		memcpy(full_argv + cl_argc, argv, argc * sizeof(gchar *));
+		if (argv)

I only language lawyer C++.

Perhaps it would be better to reference memcpy() docs:
```
If either dest or src is an invalid or null pointer, the behavior is undefined, even if count is zero.
```
so this is ok unless somebody finds a problem with it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/2960#discussion_r756606863
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20211124/730389d9/attachment.htm>


More information about the Github-comments mailing list